-
Notifications
You must be signed in to change notification settings - Fork 626
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
Requiring unknown module "undefined" #152
Comments
Thanks for reporting @andrew-wagner89 ! if you're able to create the repro example it will help us find the root cause |
You can also try modifying my test RN repo and if you can reproduce it there send a PR so I can take a look at it |
Ok I've been able to reproduce the issue thanks to the information in react-native-maps/react-native-maps#2051 . The problem is happening when there are 2 requires to the same file but with different forms in the same module, for example:
This is what happened to I'm working on a fix to metro ATM |
Ah that makes sense, in most cases we use @providesModule, but if its in the same folder we use relative imports. Good catch! |
I wish it were obvious which module was causing this problem in my codebase. |
I'm still seeing this issue and looking for a fix. I've tried renaming modules, moving files, making the exports all named, nothing seems to work. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Moving this issue from react native to here
When creating a dev build on react native 0.54.2, the app never starts due to the error 'Requiring unknown module "undefined". If you are sure the module is there, try restarting Metro Bundler.'
The dev build had no errors bundling when React native was at v0.53.0, and the Metro version was bumped in the upgrade
This error occurs for some relative imports in the project. I'm not sure which relative imports work and which don't, I'm trying to create a minimal example. Converting the problem ones to @providesModule imports solves the issue, but that is just a workaround and a hassle for larger projects.
I've tried using yarns "resolutions" in my package.json to bump Metro to v0.29.0 and v0.30.0, but the bundler wouldn't even start due to a "Cannot read property 'length' of undefined" error.
my resolutions section to bump metro to v0.30.0:
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can
yarn install
andyarn test
.in progress...
What is the expected behavior?
A project which bundled without error for RN v0.53.x will bundle successfully in RN 0.54.x
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
react native version: 0.54.2
metro version: 0.28.0, 0.29.0, and 0.30.0
node version: 8.4.0
yarn version: 1.5.1
The text was updated successfully, but these errors were encountered: