From 90a59cfe7bfee25435ac5e7812ef931698b4bb2b Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Tue, 24 Sep 2024 21:20:42 +0800 Subject: [PATCH] support rn75 --- src/bundle.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/bundle.js b/src/bundle.js index e62ec3f..0d3628f 100644 --- a/src/bundle.js +++ b/src/bundle.js @@ -51,9 +51,20 @@ async function runReactNativeBundleCommand( fs.emptyDirSync(outputFolder); - let cliPath = require.resolve('react-native/local-cli/cli.js', { - paths: [process.cwd()], - }); + let cliPath; + + try { + // rn >= 0.75 + cliPath = require.resolve('@react-native-community/cli/build/bin.js', { + paths: [process.cwd()], + }); + } catch (e) { + // rn < 0.75 + cliPath = require.resolve('react-native/local-cli/cli.js', { + paths: [process.cwd()], + }); + } + let usingExpo = false; try { require.resolve('expo-router', {