Skip to content

Cannot set "location" - React native 0.79.5 #43

@MP-lhiggitt

Description

@MP-lhiggitt

Adding import 'node-libs-react-native/globals.js'; to my App.tsx results in the following error:

Image

Looking at globals.js

global.Buffer = require('buffer').Buffer;
global.process = require('process');

// Needed so that 'stream-http' chooses the right default protocol.
global.location = { // <----- This seems to be the issue
  protocol: 'file:',
};

// Some modules expect userAgent to be a string
global.navigator.userAgent = 'React Native';

const { encode, decode } = require("base-64");
global.atob = decode;
global.btoa = encode;

Is this library still maintained?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions