From 02b42cfb3b0d30538802b79eae14a771279ff14d Mon Sep 17 00:00:00 2001 From: Ismar Besic Date: Mon, 26 Jan 2026 08:43:26 +0100 Subject: [PATCH] fix: hermes-compiler path for RN 0.82+ in the hermes bytecode plugin --- .changeset/cuddly-months-think.md | 5 +++++ .../utils/getHermesCLIPath.ts | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .changeset/cuddly-months-think.md diff --git a/.changeset/cuddly-months-think.md b/.changeset/cuddly-months-think.md new file mode 100644 index 000000000..6f79b23d7 --- /dev/null +++ b/.changeset/cuddly-months-think.md @@ -0,0 +1,5 @@ +--- +"@callstack/repack": patch +--- + +Fix hermes-compiler path for RN 0.82+ in the hermes bytecode plugin diff --git a/packages/repack/src/plugins/HermesBytecodePlugin/utils/getHermesCLIPath.ts b/packages/repack/src/plugins/HermesBytecodePlugin/utils/getHermesCLIPath.ts index c5cad5b33..61b031414 100644 --- a/packages/repack/src/plugins/HermesBytecodePlugin/utils/getHermesCLIPath.ts +++ b/packages/repack/src/plugins/HermesBytecodePlugin/utils/getHermesCLIPath.ts @@ -1,3 +1,4 @@ +import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; @@ -20,7 +21,7 @@ const getHermesOSBin = (): string | null => { /** * Determines the path to the Hermes compiler binary. * - * Defaults to './node_modules/react-native/sdks/hermesc/{os-bin}/hermesc' + * Defaults to './node_modules/hermes-compiler/hermesc/{os-bin}/hermesc' */ export const getHermesCLIPath = (reactNativePath: string): string => { const osBin = getHermesOSBin(); @@ -32,5 +33,19 @@ export const getHermesCLIPath = (reactNativePath: string): string => { ); } + const hermesCompilerPath = path.join( + reactNativePath, + '..', + 'hermes-compiler', + 'hermesc', + osBin, + 'hermesc' + ); + + if (fs.existsSync(hermesCompilerPath)) { + return hermesCompilerPath; + } + + // Fallback to the previous hermesc path in older react native versions, <0.82. return path.join(reactNativePath, 'sdks', 'hermesc', osBin, 'hermesc'); };