Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Naming collision #34

Closed
rayronvictor opened this issue Jan 8, 2018 · 2 comments
Closed

Naming collision #34

rayronvictor opened this issue Jan 8, 2018 · 2 comments

Comments

@rayronvictor
Copy link

  • Version: 8.9.3
  • Platform: 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
  • Subsystem: nodejs-mobile-react-native

Naming collision between
ios/build/Build/Products/Debug-iphonesimulator/myapp.app/nodejs-project/package.json
and
myapp/nodejs-assets/nodejs-project/package.json

Warning:

This warning is caused by a @providesModule declaration with the same name across two different files.
jest-haste-map: @providesModule naming collision:
Duplicate module name: sample-node-project
Paths: /Users/rayronvictor/Documents/workspace/instagramdownloaderapp/ios/build/Build/Products/Debug-iphonesimulator/instagramdownloaderapp.app/nodejs-project/package.json collides with /Users/rayronvictor/Documents/workspace/instagramdownloaderapp/nodejs-assets/nodejs-project/package.json

@jaimecbernardo
Copy link
Member

Hi @rayronvictor , thank you for the issue.

This behavior seems to be caused by some .js files being copied as part of the build process and then the React Native Packager throwing a warning due to detecting different package.json files with the same module name. It shouldn't affect the use of the plugin. Please let us know if this affects your project in any other way than a Warning while running the packager.

I've researched into this issue and there's a way to have the React-Native packager ignore some paths in your project, so you don't get the warnings anymore: facebook/react-native#7271
This solution seems to not be consistent between React Native versions, due to packager/paths changes, as mentioned in the issue.

Based on that issue, I've been able to eliminate the warnings on React Native 0.52.0 by including the following rn-cli.config.js file in the project's root:

const blacklist = require('metro/src/blacklist');

module.exports = {
  getBlacklistRE: function() {
    return blacklist([
        /nodejs-assets\/.*/,
        /android\/.*/,
        /ios\/.*/
    ]);
  },
};

This will make the packager ignore the nodejs-assets/, android/ and ios/ paths in your project, since those shouldn't be needed by the React Native JS runtime, anyway (if they are, these exclusions can be made more specific, like /ios\/build\/.*/ in your case) .
Running react-native start --resetCache in the project's root might be needed so the react-native packager clears its cache.

I hope this is helpful and solves your issue.

@jaimecbernardo
Copy link
Member

This issue has been open for a while and was about react-native project setup quirks, so I'm closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants