Debug React Native iOS release

20 Nov 2018

If you’re having problems with your iOS release then it may mean there was a problem with the build and main.jsbundle was not created. To begin with, delete appName/ios/main.jsbundle then attempt to manually create a new production release build:

react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

You may find there’s a problem with your build such as maximum call stack size exceeded. For me, this was fixed with the magical: rm -rf node_modules

When there are no problems, main.jsbundle should be created automatically when building a production release.

Also during the normal production build process, --dev=false will be used to set __DEV__ to false.

Background on building a production release

During the development process, React Native has loaded your JavaScript code dynamically at runtime. For a production build, you want to pre-package the JavaScript bundle and distribute it inside your application. Doing this requires a code change in your code so that it knows to load the static bundle.
This will now reference the main.jsbundle resource file that is created during the Bundle React Native code and images Build Phase in Xcode.