Hermes V1
Hermesv1 is currently only an experimental feature and is not enabled by default; at present, it can only be guaranteed to function normally.
Step 1: Build Hermes V1 binaries(**Only macOS can build)
pnpm build:hermesv1
Step 2: Configure Hermes compiler override
Add the Hermes V1 compiler package override to your root package.json.
"pnpm": {
"overrides": {
"hermes-compiler": "250829098.0.9"
}
}
Then install the overridden package:
pnpm install
Step 3: Bundle JavaScript with Hermes V1 compiler
cd packages/tester
pnpm bundle:hermesv1
Step 4: Configure native build for V1 runtime
Option A: Edit CMakeLists.txt
Edit packages/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/JSEngine/hermes/CMakeLists.txt:
# Change line 1 from:
set(HERMES_V1_ENABLED OFF CACHE BOOL "Build with support for Hermes v1")
# To:
set(HERMES_V1_ENABLED ON CACHE BOOL "Build with support for Hermes v1")
Option B: Pass CMake argument
Add to your cmake build configuration (exact method depends on your setup):
-DHERMES_V1_ENABLED=ON
Step 5: Build and run the app
Verification
- Build logs: Look for
HERMES_V1_ENABLED is set to: ONin CMake output - Bytecode version: Run the following command and validate if
#0x62is printed
objdump -d packages/tester/harmony/react_native_openharmony/src/main/cpp/third-party/prebuilt/debug/arm64-v8a/libhermesvm.so | grep -A 2 getBytecodeVersion | grep "mov.*#0x" | awk '{print $5, $6}'
Note: Requires objdump/binutils. If unavailable, skip to runtime verification. 3. Runtime: Calling the following method should return "250829098.0.9" in Hermes V1
HermesInternal.getRuntimeProperties()['OSS Release Version'];