Skip to content

Commit f10d4d3

Browse files
committed
Add option to disable Hermes for React Native bundle
1 parent 0f44de7 commit f10d4d3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

cli.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@
154154
},
155155
"rncli": {
156156
"default": false
157+
},
158+
"disableHermes": {
159+
"default": false
157160
}
158161
}
159162
},

src/bundle.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ async function runReactNativeBundleCommand({
3030
platform,
3131
sourcemapOutput,
3232
config,
33+
disableHermes,
3334
cli,
3435
}: {
3536
bundleName: string;
@@ -39,6 +40,7 @@ async function runReactNativeBundleCommand({
3940
platform: string;
4041
sourcemapOutput: string;
4142
config?: string;
43+
disableHermes?: boolean;
4244
cli: {
4345
taro?: boolean;
4446
expo?: boolean;
@@ -84,7 +86,7 @@ async function runReactNativeBundleCommand({
8486
require.resolve('@expo/cli/package.json', {
8587
paths: [process.cwd()],
8688
}),
87-
),
89+
).toString(),
8890
).version;
8991
// expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
9092
if (semverSatisfies(expoCliVersion, '>= 0.10.17')) {
@@ -221,7 +223,9 @@ async function runReactNativeBundleCommand({
221223
} else {
222224
let hermesEnabled: boolean | undefined = false;
223225

224-
if (platform === 'android') {
226+
if (disableHermes) {
227+
hermesEnabled = false;
228+
} else if (platform === 'android') {
225229
const gradlePropeties = await new Promise<{
226230
hermesEnabled?: boolean;
227231
}>((resolve) => {
@@ -904,6 +908,7 @@ export const commands = {
904908
taro,
905909
expo,
906910
rncli,
911+
disableHermes,
907912
} = translateOptions({
908913
...options,
909914
platform,
@@ -932,6 +937,7 @@ export const commands = {
932937
outputFolder: intermediaDir,
933938
platform,
934939
sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
940+
disableHermes,
935941
cli: {
936942
taro,
937943
expo,

0 commit comments

Comments
 (0)