Update build to better locate prepack script (#55536)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55536

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D92831007

fbshipit-source-id: 60089442334ca5be6046bfd7f16c816d57e62408
This commit is contained in:
Alex Hunt authored and meta-codesync[bot] committed 2026-02-12 09:38:27 -08:00
1 parent 6802eb92ff
commit b97ca6eacf
1 file changed
+9 -4
+9 -4
View File
@@ -124,10 +124,15 @@ async function buildPackage(packageName /*: string */, prepack /*: boolean */) {
// Run prepack script if configured
if (prepack) {
await new Promise((resolve, reject) => {
const child = spawn('npm', ['run', 'prepack'], {
cwd: path.resolve(PACKAGES_DIR, packageName),
stdio: ['ignore', 'ignore', 'inherit'],
});
const packagePath = path.resolve(PACKAGES_DIR, packageName);
const child = spawn(
process.execPath,
[path.join(__dirname, 'prepack.js')],
{
cwd: packagePath,
stdio: ['ignore', 'ignore', 'inherit'],
},
);
child.on('close', code => {
if (code !== 0) {
reject(new Error(`prepack script exited with code ${code}`));