react@17.0.1
react-native@0.63.4
Build without Hermes works fine.
Development build with Hermes works fine.
Production build with Hermes works fine, if I comment-out all my code and just render the first App.ts with just <Text>Works</Text>
.
If I put back all the dependencies: Redux, React-navigation, react-native-paper etc - the build process is getting stuck on 34%:
...
info Done writing bundle output
info Done writing sourcemap output
info Copying 32 asset files
info Done copying assets
/Users/main/git/my-app/app/android/app/build/generated/assets/react/release/index.android.bundle:13:134: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
...
The rest of the logs follows the same pattern:
the variable "SOMETHING" was not declared in function "SOMETHING"
The react-native run-android --variant=release
is not throwing warnings, but it is getting stuck identically to the production build:
...
info Done copying assets
<=====--------> 41% EXECUTING [3m 20s]
> :app:bundleReleaseJsAndAssets
As far as I understand, this means that the problem is caused by one of my npm dependencies. Is there an easy way to figure this out without manually poking around each dependency one by one?
I've been through all related questions on StackOverflow and react-native Github issues.
I found the root cause by building an empty APK with just one view and then plugging parts of my code and building again and again. Turns out the issue was caused by a big JSON file I had in my source code.
Hermes has a known bug. Instead of loading .json
file, I have to load a string and JSON.parse()
it.