-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[Bridge & Packager] Module resolution issues after 0.7.0-rc.2 upgrade. #1808
Comments
@tadeuzagallo - the error re: @amasad - |
@brentvatne @amasad I just want to clarify that it is not only
|
@dhrrgn - try |
@brentvatne Ok, so I have made some progress here. I had to re-install all of my dependencies, and things started working much better. Basically I just re-ran One of my dependencies is still having an issue, but I think that is an issue with that package. Basically, that package can't find any of the RN modules (I had to fork it and remove the RN peerDependency to even get it to install with the RC anyways...here is my fork of that https://github.com/tackk/react-native-icons). I will note: I am still getting the red screen with the |
Another side note BTW: Even though the packager says that it can't find all of these modules, the app runs perfectly fine with no red screens (other than the methodQueue one mentioned above).
|
Can you send a pull request for this please? I can merge right away
What was the issue you were having with peerDependencies? I believe it should let you install anyways, but it will warn you if it you don't satisfy the dependency.
Strange one there for @tadeuzagallo |
@brentvatne I will get a PR in there in a minute, here is the error regarding the peerDep:
Edit: I have this sneaking suspicion I may be doing something completely wrong, and all of this is because I am being stupid ha. |
Yes, I'm sure it was installed somewhere before, it was never bundled with react-native. Thanks for the PR.
This just says that the package expects a certain version of react-native to be installed and what you have installed doesn't satisfy the condition: |
The new version of the packager doesn't let you reach into the private module namespace of react-native so go through the public interface.
I opened an issue for react-native-icons and luckily @ide fixed react-native-keyboardevents johanneslumpe/react-native-keyboardevents@5e57191 Is there a way to reach out to more library authors and inform them of this change? |
@amasad Thanks for the clarification there. I would say a mention in the changelog under "Breaking Changes" would be sufficient, as that would have removed much of my confusion on this issue. We can close this issue now if we like. I am still not sure about the |
@amasad It is prevalent because that is how the docs show us how to do it. See the iOS Calendar Module Example as well as in the Styles Section of the Native Components docs. This is may be worth its own section on that page (or at least a prominent note). |
@amasad @brentvatne I have figured out that the Also, there is a larger issue here in that many of the "internal" modules commonly used by native components / modules are not yet available via the I updated |
@amasad, @brentvatne, @dhrrgn I did some bisecting and commit 4ac5c7e seems to cause issues at least with react-native-icons (error message: Requiring unknown module FAKIconImage. If you are sure the module is there, try restarting the packager). In the previous commit 0898bb4 a simple |
Yeah, 4ac5c7e is not the real problem. It's 2d4055e I was able to pinpoint the exact location:
If I change the lines 47-50 from this:
to this:
I'm able to |
What code is trying to reqiure FAKIconImage? Is it code within react-native-icons or your own app code? If it's the latter, requiring react-native-icons is the right solution. |
HEUREKA. So instead of FAKIconImage require I should do this in my own code:
|
@ide, my own. It was the react-native-icon's documented way of using it. So, it seems this might be a react-native-icons issue (and probably the same in other 3rd party libraries). Though, might be a good idea to document that packager can't resolve requires like that anymore from app code. |
For our case, the require is in the third party package. This is the specific line that's causing the red screen above: https://github.com/Kureev/react-native-navbar/blob/master/index.js#L15 This works fine with react-native 0.5. I haven't tested with react-native 0.6 but I can if that's helpful. |
@dhrrgn, if you're interested, I got this resolved in my own fork of react-native-icons for now: https://github.com/mnylen/react-native-icons/tree/0.7-support The methodQueue error still flashes when reloading, but it goes away. Adding the suggested |
@ide, yeah, I agree with you. Already done at corymsmith/react-native-icons#59 However, I still think this is a breaking change in the packager and should be documented, because it seems other 3rd libraries are affected too. :) |
@mnylen I've added a couple notes to the Breaking Changes section of the release notes: https://github.com/facebook/react-native/releases/tag/v0.7.0-rc. There was one mention of the change but I've expanded on it a bit. The examples have been updated to use |
I'll be more careful in the future. We actually never recommended using providesModule outside the react native codebase because it's non-standard, and relies on a global namespace which is bad for the obvious reasons. Thanks for your help with this. |
@amasad, I found another 3rd party library that doesn't work with the new packager: https://github.com/naoufal/react-native-safari-view This time it doesn't seem like incorrect use of requires though. I had require('react-native-safari-view') in my code and the main script for react-native-safari-view in package.json points to SafariViewManager.ios.js, which the packager should find, I think. I did some testing and renamed SafariViewManager.ios.js as index.ios.js + changed the main to that, and this time packager found it. Isn't having different main script than 'index.js' valid? |
I was having this same issue when I updated to 0.6. I ended up doing a clean install of react-native and reinstalling all the modules and then it worked for me just fine. I just had to transfer all my code all over again to the new folder. |
I have tried to do a clean install of all of the modules and I still get this error. Is this error an issue with 3rd part React Native components or is it something wrong with my development environment? |
The issue, as discussed above, that the some 3rd party libraries are using internal modules. They should require things through |
I know this is a different repo, but the issue I'm having is relatively the same @adamjmcgrath naoufal/react-native-speech#8 |
I wanted to test 0.7.0-rc.2, so I made the update and tried running my application. Now, everytime I stop the packager, and it restarts, I get this error:
(I am not sure that is related to the module resolution, so, I can move that to its own issue if needed)
However, that "goes away" after a second, and it replaced by module resolution errors. I am using a few 3rd-party modules, which worked fine in 0.6.0. However, now I am getting
Unable to resolve module
errors. This even happens when trying to requirereact-timer-mixin
.Furthermore, when it actually can find and import the module, that module's code then can't resolve core RN modules. Example:
The text was updated successfully, but these errors were encountered: