-
Notifications
You must be signed in to change notification settings - Fork 222
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
React Native - Requiring unknown module "undefined" #681
Comments
Thanks a lot for the notice! It looks like the issue arise when we import a module with the same path multiple times in the same file. By looking at the stack trace it happens with the According to the issue, the problem is present on the version |
To be honest, this sounds like a bug in metro(?), rather than our library. I think we can change the imports to be top-level though, although that would mean they get imported at all times, and not just when you need the file. I think it might also have an impact on bundle size, but not sure if bundlers actually make use of the fact that Maybe we can also use the |
Yes it's definitely an issue in metro. It might have a (little) impact in Node because the import will be executed when the file is required instead of when the function is called. But for the bundled files it should not impact the size (since the import are resolved at bundle time). We can even gain a little bytes since it will remove some lines. |
We’ll need to investigate this deeply, making it a priority next week ok? |
That sounds great. Thanks again for making this a priority. |
So I took a look into this, the reason was indeed a bug in metro. You can see the commit in React Native master that bumps metro here: facebook/react-native@b02b167 What you can do is use the yarn resolution feature (https://yarnpkg.com/en/docs/selective-version-resolutions), or adding 0.30.2 as a dependency to your app to resolve the correct version of metro, with the fix. Feel free to reopen if you tried that and it still didn't work. |
@Haroenv I tried adding resolutions to our project:
However, we are getting an error when the bundler starts (doesn't even give us a stack trace): If we don't go the resolutions route, but add metro and metro-core to our project package.json, will that change the version of metro that RN uses? Any pointers would be greatly appreciated, thanks again! |
You could try that out, but if you could give us access to a minimal reproduction of the problem, it would save a lot of time :). Otherwise I think the easiest would be to downgrade, wait, and upgrade |
Any update on this fix? It will affect every react-native developer who uses this soon... |
Did you try using the specified metro version @GeoffreyPlitt? AFAIK this has been fixed on RN’s side, just not released yet. Otherwise you can stay on RN 0.53.x rather than 0.54.x and upgrade immediately to 0.55.x when that’s available :) if you have a project in which this can be reproduced, it would be very useful! |
This issue arise with the version 0.54.x of React Native. To solve the issue you should either upgrade on 0.55.x or downgrade on the 0.53.x. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When searching quickly and tapping elsewhere on a component, we are seeing the following error:
I've found an issue on react-native that may shed more light on this issue:
What is the expected behavior?
App should not crash.
Other Details
"algoliasearch": "^3.26.0",
"react": "^16.3.0-alpha.1",
"react-native": "0.54.1",
The text was updated successfully, but these errors were encountered: