Skip to content

react-native Buffer is not definedΒ #42

@tjbenton

Description

@tjbenton

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions