Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I have a lerna monorepo where i decided to scope the packages inside. When I run lerna link --force-local
(which essentially symlinks my local packages inside of others if they are mentioned in the package.json
) my React Native app at some point will have the following directory in it: ./node_modules/@scope/ui
and ui
is the symlinked directory.
If I now start the metro bundler and run the app, it will throw following error:
error: bundling failed: Error: Unable to resolve module `@scope/ui` from `/Projects/myMainLerna/packages/myRnApp/index.js`: Module `@scope/ui` does not exist in the Haste module map
I have seen all the other issues around this like facebook/react-native#4968 and #241 and many others, but this is something unrelated to the causes in the other issues.
How do I know it's a problem with symlinked packages? I simply threw a real copy of my package into my ./node_modules/@scope/ui
and it started working. It might be though that symlinked packages, if not put into a scope directory, work - I don't know because I didn't try that one.
How to reproduce and a minimal repository on GitHub
https://github.com/mxmzb/MetroLinkedHasteExample and follow the README instructions
What is the expected behavior?
App finds and uses the package.
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
Note: it doesn't seem to matter if I use yarn or npm.
Metro configuration: As it comes with React Native
node: 8.12.0
yarn: 1.10.1
npm: 6.4.1
All on macOS