fix(precompile) fixed replace script deleting the react-vfs.yaml file on iOS (#55394)

Summary:
When the user switches from Debug -> Release we'll replace the React-Core-prebuilt XCFramework.

Previously we nuked the ios/Pods/React-Core-prebuilt folder - but after we added support for VFS overlays to honor header files in the XCFramework this folder will also contain the VFS-file (React-VFS.yaml) which shouldn't be removed.

Removing this file causes an error when building.

This commit fixes this by deleting all directories inside the Pods/React-Core-prebuilt folder, leaving any files (React-VFS.yaml) untouched.

I've tested this in a new project and in RN-Tester and it works. I measured the size of the XCFramework when switching between Debug/Release to confirm that the switch still works.

I also changed the name of the podspec script since it showd RNDeps and not RNCore.

This issue was introduced in https://github.com/facebook/react-native/issues/54842 and not yet released in any version.

## Changelog:

[IOS] [FIXED] - Fixed replace script deleting the react-vfs.yaml file on iOS

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

Test Plan: Run RN-Tester with precompiled binaries and build both release and debug.

Reviewed By: cortinico

Differential Revision: D92159099

Pulled By: cipolleschi

fbshipit-source-id: 3ae7bd03431b225672ac4b4f7b91e6ef44765019
This commit is contained in:
Christian Falch authored and meta-codesync[bot] committed 2026-02-05 08:08:33 -08:00
1 parent 141e021509
commit 11e257cec0
2 files changed
+13 -4

No files matched your search

@@ -52,7 +52,7 @@ Pod::Spec.new do |s|
# If we are passing a local tarball, we don't want to switch between Debug and Release
if !ENV["RCT_TESTONLY_RNCORE_TARBALL_PATH"]
script_phase = {
:name => "[RNDeps] Replace React Native Core for the right configuration, if needed",
:name => "[RNCore] Replace React Native Core for the right configuration, if needed",
:execution_position => :before_compile,
:script => <<-EOS
. "$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
+12 -3
View File
@@ -62,9 +62,18 @@ function replaceRNCoreConfiguration(
const tarballURLPath = `${podsRoot}/ReactNativeCore-artifacts/reactnative-core-${version.toLowerCase()}-${configuration.toLowerCase()}.tar.gz`;
const finalLocation = 'React-Core-prebuilt';
console.log('Preparing the final location', finalLocation);
fs.rmSync(finalLocation, {force: true, recursive: true});
fs.mkdirSync(finalLocation, {recursive: true});
// Delete all directories - not files, since we want to keep the React-VFS.yaml file
const dirs = fs
.readdirSync(finalLocation, {withFileTypes: true})
.filter(dirent => dirent.isDirectory());
for (const dirent of dirs) {
const direntName =
typeof dirent.name === 'string' ? dirent.name : dirent.name.toString();
const dirPath = `${finalLocation}/${direntName}`;
console.log('Removing directory', dirPath);
fs.rmSync(dirPath, {force: true, recursive: true});
}
console.log('Extracting the tarball', tarballURLPath);
spawnSync('tar', ['-xf', tarballURLPath, '-C', finalLocation], {