Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

react-native Buffer is not defined #42

Open
tjbenton opened this issue Jun 20, 2018 · 3 comments
Open

react-native Buffer is not defined #42

tjbenton opened this issue Jun 20, 2018 · 3 comments
Assignees
Labels

Comments

@tjbenton
Copy link

tjbenton commented Jun 20, 2018

When trying to use this library with react-native it throws the following error saying Buffer is not defined.

screen shot 2018-06-20 at 9 49 45 am

I know I can install buffer as a dependency but I would like to avoid adding another dependency to my project when we aren't using Buffer at all.

I resolved the error by adding the following to my code before I used deepExtend.

global.Buffer = global.Buffer || class Buffer {}

if you actually need the functionality for another library, install buffer as a dependency

global.Buffer = global.Buffer || require('buffer').Buffer
@vicapow
Copy link

vicapow commented Dec 4, 2018

this also affects client side code that doesn't have the Buffer polyfill. this recently caused issues in aurora-opensource/streetscape.gl#167

the fix should just be to check for buffer existing using typeof Buffer !== 'undefined' before using Buffer

@vicapow
Copy link

vicapow commented Dec 4, 2018

looks liked, based on #27
This module is not actively maintained

@ardok
Copy link

ardok commented Feb 12, 2019

Was wondering about this. Will switch to lodash.merge instead

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants