Skip to content Skip to sidebar Skip to footer

Babel-preset-env Syntaxerror: Unexpected Token With Spread Properties

Why its not accepting spread properties ? I am using babel-preset-env for this. .babelrc { 'presets': [ 'react', [ 'env', {

Solution 1:

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"
    ]
}

Post a Comment for "Babel-preset-env Syntaxerror: Unexpected Token With Spread Properties"