7kfpun / FinanceReactNative

[Deprecated] iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).
https://play.google.com/store/apps/details?id=com.kfpun.finance
MIT License
2.05k stars 627 forks source link

Packager error: naming collision AutoFocusUtils #10

Closed edhemphill closed 7 years ago

edhemphill commented 8 years ago

Thanks for the outstanding demo app!

There appears to be a conflict with an inner module using it's own react. The error from the packager look like this:

Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: AutoFocusUtils
  Paths: /Work/FinanceReactNative/node_modules/react-native-router-flux/node_modules/react-native-experimental-navigation/node_modules/react/lib/AutoFocusUtils.js collides with /Work/FinanceReactNative/node_modules/react/lib/AutoFocusUtils.js

This error is caused by a @providesModule declaration with the same name accross two different files.
Error: @providesModule naming collision:
  Duplicate module name: AutoFocusUtils
  Paths: /Work/FinanceReactNative/node_modules/react-native-router-flux/node_modules/react-native-experimental-navigation/node_modules/react/lib/AutoFocusUtils.js collides with /Work/FinanceReactNative/node_modules/react/lib/AutoFocusUtils.js

This error is caused by a @providesModule declaration with the same name accross two different files.
    at HasteMap._updateHasteMap (/Work/FinanceReactNative/node_modules/react-native/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:160:15)
    at /Work/FinanceReactNative/node_modules/react-native/node_modules/node-haste/lib/DependencyGraph/HasteMap.js:125:25

This is because react-native-router-flux ends up including a react copy itself.

My workaround for this was making a rn-cli.config.js file in the root of the project, with this code (adjust your regex as needed):

var blacklist = require('react-native/packager/blacklist');

var config = {
  getBlacklistRE(platform) {
    return blacklist(platform, [
      /FinanceReactNative\/node_modules\/react-native-router-flux\/node_modules\/react-native-experimental-navigation\/node_modules\/react\/.*/
    ]);
  }
};

module.exports = config;

More info on a similar issue here

7kfpun commented 8 years ago

Thanks @edhemphill !!