Search code examples
iosreact-nativeuglifyjsreact-native-ios

React Native bundling: SyntaxError: Unexpected token: operator (*)


When I run attempt to bundle my app with:

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

I get the following error, with no other details:

SyntaxError: Unexpected token: operator (*)

For what it's worth, this works (with --dev true):

react-native bundle --platform ios --dev true \
    --entry-file index.ios.js --bundle-output iOS/main.jsbundle

My best guess is that the issue is somewhere in an UglifyJS step, perhaps related to:

https://github.com/mishoo/UglifyJS2/issues/1199

Any tips? Suggestions for where to dig deeper are welcome! Thanks!


Solution

  • We found the line number with:

    ./node_modules/.bin/esvalidate --formatter=sublime.js ios/main.jsbundle
    

    The issue was the use of the ** ES6 operator. Reverted to Math.pow().