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": { "rncli": {
"default": false "default": false
},
"disableHermes": {
"default": false
} }
} }
}, },

View File

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