parshap/node-libs-react-native

Fix: extraNodeModules -> resolver.extraNodeModules

Closed this issue · 2 comments

Not sure when this changed, but to avoid this error:

error: bundling failed: Error: Unable to resolve module `path` from `.../index.js`: Module `path` does not exist in the Haste module map

I had to change this example of extraNodeModules from the README:

// rn-cli.config.js
module.exports = {
  extraNodeModules: require('node-libs-react-native'),
};

to be resolver.extraNodeModules:

// rn-cli.config.js
module.exports = {
  resolver: {
    extraNodeModules: require('node-libs-react-native'),
  },
};

as per the latest metro docs:

Yes, this changed in the bundler at some point. Would you be interested in sending a PR to make this change?