Closed alzalabany closed 3 years ago
this error occurs when you use react-native bundle
use this
react-native bundle --platform android --dev false --entry-file packages/mobile/index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
--entry-file
is defined packages/mobile/index.js
instead of index.js
the bundle is not recommended.
Try changing the path to index
within MainApplication.java
in packages/mobile/android/app/src/main/java/
:
@Override
protected String getJSMainModuleName() {
return "packages/mobile/index";
}
Changing the index path is not the right way, because every platform has a different config in the index file.
@hosseinmd agree, but I also stumbled upon this problem and didn't find other solution. (react-native bundle
didn't work)
I think you have a problem in build.Gradle. Please check this.
project.ext.react = [
entryFile: "packages/mobile/index.js",
root: "../../../../",
]
@hosseinmd I made a small PR fixing this issue. Tested on android
and ios
emulators on macOS Catalina
/cc @brunolemos
enviroment: Windows 10 latest yarn, ts
git clone repo.. cd yarn && yarn workspace mobile start
bundling failed: Error: Unable to resolve module
./app.json
fromC:\workspace\react-native-web-monorepo\index.js
: The module./app.json
could not be found fromC:\workspace\react-native-web-monorepo\index.js
. Indeed, none of these files exist:app.json