问题
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