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

'ambiguous resolution module' when bundler compiling linked projects with both package.json contains same dependency #22471

Closed
3 tasks done
jerinho opened this issue Dec 1, 2018 · 1 comment
Labels
Bug Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@jerinho
Copy link

jerinho commented Dec 1, 2018

Environment (react-native info)

Environment:

  • OS: Windows 10
  • Node: 8.11.4
  • Yarn: 1.9.4
  • npm: 6.4.1

Packages: (wanted => installed)

  • react: 16.6.1 => 16.6.1
  • react-native: 0.57.7 => 0.57.7

Description

In a library project which is created using react-native-create-library, by default node_modules directory is not loaded up with packages including react and react-native. It's working just fine if we only do native coding. The problem is when we need to import and use a package to put some javascript code. Unable to resolve module signify that an application project never share it's module packages to the linked library project. Unfortunately, neither we can add a package to library project. When a project is linked to other project via symlink (on Windows the link is resided in C:\Users...\AppData\Local\Yarn\Data\link), all package.json file from each linked projects are not allowed to contains the same dependency among each other. If we compile in such condition, this error come out

bundling failed: ambiguous resolution: module C:\Users\USER\Desktop\test\index.js tries to require react, but there are several files providing this module. You can delete or fix them:

*C:\Users\USER\AppData\Local\Yarn\Data\link\react-native-mylibrary\node_modules\react\package.json
*C:\Users\USER\Desktop\test\node_modules\react\package.json

It's totally out of mind if we have to export native module via a limitable version of .js and we cannot even unlimit it. So I think it's seriously a bug which need to be debugged. Thank you

Reproducible Demo

  1. Follow this instructions https://facebook.github.io/react-native/docs/native-modules-android
  2. Let say you want to use module Component. From library project directory, yarn add react --save to add the package and import it from a .js
  3. react-native run-android from an application project directory and you'll meet the error

References

@jerinho jerinho changed the title 'ambiguous resolution module' when bundler compiling a linked projects with both package.json contains same dependency 'ambiguous resolution module' when bundler compiling linked projects with both package.json contains same dependency Dec 1, 2018
@react-native-bot react-native-bot added the Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. label Dec 1, 2018
@jerinho jerinho closed this as completed Dec 2, 2018
@jerinho jerinho reopened this Dec 5, 2018
@hramos hramos removed the Bug Report label Feb 6, 2019
@bartolkaruza
Copy link

Hey there, thanks for taking the time to write this issue! However, unfortunately we're struggling to understand the exact issue you are trying to describe. It would help if you could summarise the exact issue you would like us to focus on and provide a minimal reproduction repository. We're happy to reopen the issue when you post these.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests

4 participants