知道我为什么会收到这个错误吗?因为我已尽力解决这个问题但由于某种原因它不会消失,任何帮助都将是一个奖励
./client/components/Material-Form.jsx中的错误
模块构建失败:SyntaxError:意外的令牌(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 file
中设置。
您可以阅读更多关于transform-object-rest-spread
Here的内容