知道为什么我会收到此错误吗?由于我已尽一切努力来解决此问题,但由于某种原因它不会消失,任何帮助都将是额外的奖励
ERROR in ./client/components/Material-Form.jsx
Module build failed: SyntaxError: Unexpected token (8:35)
6 | import validate from "../helpers/validate";
7 |
> 8 | const renderRadioGroup = ({ input, ...rest }) => (
| ^
9 | <RadioButtonGroup
10 | {...input}
11 | {...rest}
.babelrc
{
"presets": [
"react",
["env", {
"targets": {
"browsers": "last 2 versions"
},
"loose": true,
"modules": false
}]
],
"env": {
"test": {
"plugins": [
"transform-es2015-modules-commonjs",
"babel-plugin-transform-class-properties"
]
}
}
最佳答案
尝试安装 babel-plugin-transform-object-rest-spread 并在 "plugins": ["transform-object-rest-spread"]
中进行设置您的 .babelrc 文件
。
您可以阅读有关 transform-object-rest-spread
Here 的更多信息
关于javascript - 破坏参数会导致语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49040181/