babel-preset-env SyntaxError: Unexpected token with spread properties

后端 未结 1 939
陌清茗
陌清茗 2021-01-05 13:57

Why its not accepting spread properties ? I am using babel-preset-env for this.

.babelrc

         


        
相关标签:
1条回答
  • 2021-01-05 14:28

    The Object rest spread operator will probably be a future feature of an ECMAScript specification (it's in stage 3 for the moment).

    For now, it can be supported thanks to Babel but you have to use the transform-object-rest-spread plugin.

    {
        "presets": [
            "react",
            [
                "env",
                {
                    "targets": {},
                    "debug": true,
                    "modules": "commonjs"
                }
            ],
            "transform-object-rest-spread"
        ]
    }
    
    0 讨论(0)
提交回复
热议问题