Skip to content

Instantly share code, notes, and snippets.

@lucasrose
Last active January 25, 2024 03:35
Show Gist options
  • Select an option

  • Save lucasrose/9a224a76fb30125c1550cd81b71b8dad to your computer and use it in GitHub Desktop.

Select an option

Save lucasrose/9a224a76fb30125c1550cd81b71b8dad to your computer and use it in GitHub Desktop.
Bug in Expo 50+ in ExpoModulesCore for x86_64-apple-ios-simulator not found
const fs = require("fs");
const path = require("path");
const configPlugins = require("expo/config-plugins");
const generateCode = require("@expo/config-plugins/build/utils/generateCode");
const code = `
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
end
end
`;
const withReactAppleIosSimulatorNotFoundFix = config => {
return configPlugins.withDangerousMod(config, [
"ios",
async config => {
const filePath = path.join(
config.modRequest.platformProjectRoot,
"Podfile"
);
const contents = fs.readFileSync(filePath, "utf-8");
const addCode = generateCode.mergeContents({
tag: "withReactAppleIosSimulatorNotFoundFix",
src: contents,
newSrc: code,
anchor:
/\s*installer.target_installation_results.pod_target_installation_results/i,
offset: -2,
comment: "#",
});
if (!addCode.didMerge) {
console.error(
"ERROR: Cannot add withReactAppleIosSimulatorNotFoundFix to the project's ios/Podfile because it's malformed."
);
return config;
}
fs.writeFileSync(filePath, addCode.contents);
return config;
},
]);
};
module.exports = withReactAppleIosSimulatorNotFoundFix;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment