Bundlejs error on release build in Xcode (react-native)


Bundlejs error on release build in Xcode (react-native)



For some reason I am getting the following error when building a release version of my application via react-native.



*** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: t.typeof is not a function. (In 't.typeof("function"==typeof Symbol?Symbol.iterator:"@@iterator")', 't.typeof' is undefined) (/Users/../THEAPP.app/main.jsbundle:11)', reason: 'Unhandled JS Exception: t.typeof is not a function. (In 't.typeof("function...'



This is the source of the code that has the above error that I found in my bundlejs file:


!(function(e){"use strict";var r,t=e.babelHelpers={};t.typeof="function"==typeof Symbol&&"symbol"===t.typeof("function"==typeof Symbol?Symbol.iterator:"@@iterator")?



I have tried both of these methods of a release build:


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



I get the same error for both of these. And of course, this is after I change my AppDelegate.m to the following:


//jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];



I also followed someone's response from Github issues and tried the following, but got another separate issue entirely after the fact:



I did:


npm uninstall -g babel-preset-env
npm install --save @babel/preset-env



Added this to my package.json file


"babel": { "presets": ["@babel/preset-env", "react-native"] }



And created a .babelrc file in my root project with:


.babelrc


{ "presets": ["@babel/preset-env", "react-native"] }



Then get this on an Xcode build:



enter image description here



Environment




1 Answer
1



I solved this by completely restarting my app and using:


react-native init PROJECTNAME






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Opening a url is failing in Swift

Export result set on Dbeaver to CSV