Solve React Native custom shell script stuck for long time in Xcode

Disclaimer, I develop React Native app in Windows platform and Android version first. For iOS version, compile in Xcode is my last process for testing or deploy. So the following tip may not suitable for your case.

Each time, when build React Native app in Xcode, no matter it is build for simulator or device, the long building time is a painful waiting process.

It stuck at custom shell script process, which is running ../node_modules/react-native/scripts/

This script compile js files together for embed in the app and it takes a very long time for scan through all node_modules

Since I develop in Windows platform, I can use this command to package js files faster react-native bundle --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios

In Xcode, I can skip this custom shell script process by tick Run script only when installing, it will disable actually, file main.jsbundle will not include in the app and the app cannot run.

So we have to include the main.jsbundle by add them to Copy Bundle Resources

Build the app again, you will find the compile speed is much faster now.

If you have (new added) image files, this trick will not bundle the image files into app, so please go through the normal process first. This trick is for update js files only.