我在使用react-native run-android
进行测试时运行正常,但是当我尝试在发布模式下构建它时(构建APK文件),我有以下错误。
错误:
uncaught error SyntaxError: unknown: 'import' and 'export' may only appear at the top level (30477:0)
30475 |
30476 |
> 30477 | export default conf;
| ^
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
我猜它来自 Babel 或 Eslint ,但我找不到原因。
有人知道吗?
感谢。