1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 09:41:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Add option to disable Hermes for React Native bundle

This commit is contained in:
sunnylqm
2025-02-15 21:40:28 +08:00
parent 0f44de772f
commit f10d4d3004
2 changed files with 11 additions and 2 deletions

View File

@@ -154,6 +154,9 @@
},
"rncli": {
"default": false
},
"disableHermes": {
"default": false
}
}
},

View File

@@ -30,6 +30,7 @@ async function runReactNativeBundleCommand({
platform,
sourcemapOutput,
config,
disableHermes,
cli,
}: {
bundleName: string;
@@ -39,6 +40,7 @@ async function runReactNativeBundleCommand({
platform: string;
sourcemapOutput: string;
config?: string;
disableHermes?: boolean;
cli: {
taro?: boolean;
expo?: boolean;
@@ -84,7 +86,7 @@ async function runReactNativeBundleCommand({
require.resolve('@expo/cli/package.json', {
paths: [process.cwd()],
}),
),
).toString(),
).version;
// expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
if (semverSatisfies(expoCliVersion, '>= 0.10.17')) {
@@ -221,7 +223,9 @@ async function runReactNativeBundleCommand({
} else {
let hermesEnabled: boolean | undefined = false;
if (platform === 'android') {
if (disableHermes) {
hermesEnabled = false;
} else if (platform === 'android') {
const gradlePropeties = await new Promise<{
hermesEnabled?: boolean;
}>((resolve) => {
@@ -904,6 +908,7 @@ export const commands = {
taro,
expo,
rncli,
disableHermes,
} = translateOptions({
...options,
platform,
@@ -932,6 +937,7 @@ export const commands = {
outputFolder: intermediaDir,
platform,
sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
disableHermes,
cli: {
taro,
expo,