You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support vendoring Hermes for out-of-tree platforms #270
assert(appPackageRoot,"Failed to find package root");
constreactNativePath=path.dirname(
require.resolve("react-native/package.json",{
// Ensures we'll be patching the React Native package actually used by the app
paths: [appPackageRoot],
}),
);
For out-of-tree platforms like react-native-macos, though, I had to apply the following patch before it'd resolve the correct root during pod install:
letreactNativePath;if(from.endsWith("ios")||from.endsWith("android")){reactNativePath=node_path_1.default.dirname(require.resolve("react-native/package.json",{// Ensures we'll be patching the React Native package actually used by the apppaths: [appPackageRoot],}));}elseif(from.endsWith("macos")){reactNativePath=node_path_1.default.dirname(require.resolve("react-native-macos/package.json",{// Ensures we'll be patching the React Native package actually used by the apppaths: [appPackageRoot],}));}elseif(from.endsWith("windows")){reactNativePath=node_path_1.default.dirname(require.resolve("react-native-windows/package.json",{// Ensures we'll be patching the React Native package actually used by the apppaths: [appPackageRoot],}));}else{thrownewError("Unsupported platform.");}
There is surely a more elegant way to do it (it would be nicest to know the platform for certain, rather than just guessing based on the presence of an ios/android/macos folder in the path), but just to illustrate the point.
Another issue here is that we download the Hermes fork into the host package (node_modules/react-native-node-api/hermes) and assume there will be a single version needed. Perhaps we should download it into the react-native package (or react-native-macos / react-native-windows) instead? 🤔
I've put up a #287 as a suggestion - let me know what you think 🙂
Reopening the issue, since we'd like to detect the relevant --react-native-package, either in scripts/patch-hermes.rb or as part of computing a default value inside the CLI.
Activity
kraenhansen commentedon Oct 23, 2025
Another issue here is that we download the Hermes fork into the host package (
node_modules/react-native-node-api/hermes) and assume there will be a single version needed. Perhaps we should download it into thereact-nativepackage (orreact-native-macos/react-native-windows) instead? 🤔I've put up a #287 as a suggestion - let me know what you think 🙂
kraenhansen commentedon Oct 26, 2025
Reopening the issue, since we'd like to detect the relevant
--react-native-package, either in scripts/patch-hermes.rb or as part of computing a default value inside the CLI.