Error on building bundle
My app runs fine when testing with react-native run-android or running in xCode, but when I try to bundle it (react-native bundle), I have the following error.
uncaught error SyntaxError: unknown: 'import' and 'export' may only appear at the top level (30477:0)
30475 |
30476 |
> 30477 | export default cons;
| ^
30478 | });
30479 | __d('qs/lib/utils.js',function(global, require, module, exports) { var
30480 |
at Parser.pp.raise (/Users/<username>/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:1425:13)
at Parser.pp.parseStatement (/Users/<username>/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:1921:16)
at Parser.pp.parseBlockBody (/Users/<username>/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:2294:21)
at Parser.pp.parseBlock (/Users/<username>/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:2275:8)
at Parser.pp.parseFunctionBody (/Users/<username>/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:1130:22)
at Parser.pp.parseFunction (/Users/<username>/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:2406:8)
at Parser.pp.parseFunctionExpression (/Users/<username>/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:764:17)
at Parser.pp.parseExprAtom (/Users/<username>/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:726:19)
at Parser.pp.parseExprSubscripts (/Users/gregoirehamaide/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:509:19)
at Parser.pp.parseMaybeUnary (/Users/<username>/Documents/<app>/node_modules/react-native/node_modules/babylon/index.js:489:19)
:app:bundleReleaseJsAndAssets FAILED
@ghamaide could it be that you have an export statement inside a class or something else? Can you grep for export default cons; in your project and find the file? Or maybe you fixed this since february?
@facebook-github-bot label Needs more information
@facebook-github-bot no-reply
Closing this issue as more information is needed to debug this and we haven't heard back from the author. Once there's more information we can reopen the issue.