React Native JS bundle crashes on iOS Release, Babel not working?

故事扮演 提交于 2019-12-13 04:37:01

问题


My React Native build compiles in Debug and runs fine, but when I run my Release scheme the spread operators are throwing errors, causing the build to crash. Specifically, the first error thrown is from a spread operator in the NativeBase library.

For reference, my .babelrc is here:

{
    "presets": ["stage-3", "react-native"],
    "plugins": [
      "transform-es2015-destructuring", 
      "transform-object-rest-spread",
      "syntax-object-rest-spread",
      [
         "import", {
            "libraryName": "antd-mobile",
            "style": true
         }
      ]
    ]
}

The first error thrown in the bundled main.js is Unexpected token '...'. on the line with { ...props.children }:

props.type === 'checkbox' ? _react2.default.createElement(
    _reactNative.View, {
        style: babelHelpers.extends({}, styles, {
            height: 40,
            flexDirection: 'column'
        })
    }, { ...props.children }
)

Why is this error coming up in my Release build and not my Debug? And how might one fix it?

来源:https://stackoverflow.com/questions/50237039/react-native-js-bundle-crashes-on-ios-release-babel-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!