知道我为什么会收到这个错误吗?因为我已尽力解决这个问题,但出于某种原因它不会消失,任何帮助都将是奖金
./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"
]
}
}
答案 0 :(得分:3)
尝试在babel-plugin-transform-object-rest-spread
中安装"plugins": ["transform-object-rest-spread"]
并在.babelrc file
内设置。
您可以阅读有关transform-object-rest-spread
Here