破坏参数会产生语法错误

问题描述 投票:0回答:1

知道我为什么会收到这个错误吗?因为我已尽力解决这个问题但由于某种原因它不会消失,任何帮助都将是一个奖励

./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"
      ]
    }
  }
javascript reactjs material-ui
1个回答
3
投票

尝试在你的babel-plugin-transform-object-rest-spread中安装"plugins": ["transform-object-rest-spread"]并在.babelrc file中设置。

您可以阅读更多关于transform-object-rest-spread Here的内容

© www.soinside.com 2019 - 2024. All rights reserved.