react-native: Bundlejs error on release build

Note: I’ve gone through other issues but it doesn’t seem like they are getting the same error.

Environment

Environment: OS: macOS High Sierra 10.13.4 Node: 9.11.1 Yarn: Not Found npm: 5.6.0 Watchman: 4.9.1 Xcode: Xcode 9.2 Build version 9C40b Android Studio: Not Found

  • Also using Xcode 9.4

Packages: (wanted => installed) react: ^16.3.1 => 16.3.1 react-native: ^0.55.4 => 0.55.4

Description

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…’

I have tried the following:

  1. Making bundle by editing the Scheme to be a Release bundle
  2. Export a bundle myself by using the following: 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"];

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 24 (9 by maintainers)

Most upvoted comments

Hi there @bgold0 @vovkasm @codejamninja @ronal2do , I had the same pb and I fix it by replacing the content of my .babelrc file.

Before (with the bug from babelHelpers) :

{ "presets": ["env", "react-native"] }

After (🎉) :

{ "presets": ["react-native"] }

@padupuy You made my day, bro. I tried hundred configs without success and just remove presets env made my project working perfectly again. It like a dream. :lol:.

I solved this issue by completely restarting my application from scratch using:

react-native init PROJECTNAME

Then installing all my dependencies one-by-one.

Thank you so much @vovkasm for taking the time to help.