repack: Can't find variable: __webpack_require__
Environment
React Native: 0.69.7 Repack: 3.0.0 Webpack: 5.75.0 OS: Windows10 64bit
Description
I create an demo to learn repack and followed the docs to configure the demo. everything works fine until I configured the code-splitting
section. It starts to report error like below:
ERROR ReferenceError: Can’t find variable: webpack_require ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
Reproducible Demo
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (6 by maintainers)
Looks like we’re trying to tackle to many problems at the same time.
@namdao Please open a new issue. Since you are using Module Federation instead of async-chunks, the root cause of your problems might be completely different. Please add a repro repo with you code there as well, it helps a lot with investigating these kind of issues. Also, please add info about the platform you’re having issues on, the build variant (Release, Debug) and the platform you are working on (Mac, Linux, Windows). From your screenshot it looks like Release iOS, but please add that info so we’re on the same page.
@chj-damon I run your
repackDemo
codebase and after:bundle-command
toBundle React Native code and images
like the docs suggestHere’s the complete diff. The most important files are
ios/repackDemo.xcodeproj/project.pbxproj
andindex.js
I was able to build and run:
student.chunk.bundle
andteacher.chunk.bundle
)Currently I’m not able to run the Android in Release variant, the app crashes instantly after opening. I’m going to investigate it on 9th of January.
Please specify your environment info as well (the platform you’re having issues on, the build variant (Release, Debug) and the platform you are working on (Mac, Linux, Windows), thanks!
Hi @RafikiTiki , I will try investigate detail and open issue later. Thanks for your anwser
sorry about that. I’ve made it public now.