Reputation: 3067
I need to generate a js bundle for the React native project which uses Hermes.
With react native CLI I can only generate non-hermes bundle npx react-native bundle
What should I trigger to generate Hermes bundle separately?
Upvotes: 1
Views: 188
Reputation: 41
To generate a Hermes bundle separately in a React Native project, you can compile the non-Hermes bundle with the Hermes engine. Here's how you can do it:
For macOS:
./node_modules/react-native/sdks/hermesc/osx-bin/hermesc -emit-binary -out index.android.hbc PATH_TO_JSC_BUNDLE/index.android.bundle -output-source-map -w
For Windows:
.\node_modules\react-native\sdks\hermesc\win-bin\hermesc.exe -emit-binary -out index.android.hbc PATH_TO_JSC_BUNDLE\index.android.bundle -output-source-map -w
Replace PATH_TO_JSC_BUNDLE with the actual path to your React Native JavaScript bundle.
This process compiles the JavaScript bundle into Hermes bytecode (.hbc format) suitable for use with Hermes engine in React Native.
Upvotes: 0