Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM Run Build error: "Trace: The node type RestProperty has been renamed to RestElement" with new Babel 7.0.0

We get Trace: The node type RestProperty has been renamed to RestElement warnings in our build. The build succeeds but there a a bunch of these since upgrading to babel 7.0.0

I have tried the solution here Trace: The node type SpreadProperty has been renamed to SpreadElement at Object.isSpreadProperty but it does not seem to solve this issue

relevent package.json:

"devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/plugin-proposal-export-default-from": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-transform-modules-commonjs": "^7.0.0",
    "@babel/plugin-transform-regenerator": "^7.0.0",
    "@babel/polyfill": "7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
...
    "babel-core": "^7.0.0-bridge.0",
    "babel-eslint": "^10.0.0",

babelrc:

{
  "presets": ["@babel/preset-env", "@babel/preset-react"],
  "plugins": [
    "@babel/plugin-proposal-export-default-from",
    "@babel/plugin-syntax-dynamic-import",
    ["@babel/plugin-proposal-class-properties", { "loose": false }],
  ],
  "env": {
    "test": {
      "plugins": ["transform-es2015-modules-commonjs", "transform-regenerator"]
    }
  }
}
Trace: The node type RestProperty has been renamed to RestElement
    at Object.isRestProperty (/apps/node_modules/@babel/types/lib/validators/generated/index.js:4192:11)
    at DestructuringTransformer.pushObjectPattern (/apps/node_modules/babel-plugin-transform-es2015-destructuring/lib/index.js:197:15)
    at DestructuringTransformer.push (/apps/node_modules/babel-plugin-transform-es2015-destructuring/lib/index.js:108:14)
    at DestructuringTransformer.init (/apps/node_modules/babel-plugin-transform-es2015-destructuring/lib/index.js:317:12)
    at PluginPass.VariableDeclaration (/apps/node_modules/babel-plugin-transform-es2015-destructuring/lib/index.js:468:27)
    at newFn (/apps/node_modules/@babel/traverse/lib/visitors.js:193:21)
    at NodePath._call (/apps/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/apps/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/apps/node_modules/@babel/traverse/lib/path/context.js:88:12)
    at TraversalContext.visitQueue (/apps/node_modules/@babel/traverse/lib/context.js:118:16)
    at TraversalContext.visitMultiple (/apps/node_modules/@babel/traverse/lib/context.js:85:17)
    at TraversalContext.visit (/apps/node_modules/@babel/traverse/lib/context.js:144:19)
    at Function.traverse.node (/apps/node_modules/@babel/traverse/lib/index.js:94:17)
    at NodePath.visit (/apps/node_modules/@babel/traverse/lib/path/context.js:95:18)
    at TraversalContext.visitQueue (/apps/node_modules/@babel/traverse/lib/context.js:118:16)
    at TraversalContext.visitSingle (/apps/node_modules/@babel/traverse/lib/context.js:90:19)
    at TraversalContext.visit (/apps/node_modules/@babel/traverse/lib/context.js:146:19)
    at Function.traverse.node (/apps/node_modules/@babel/traverse/lib/index.js:94:17)
    at NodePath.visit (/apps/node_modules/@babel/traverse/lib/path/context.js:95:18)
    at TraversalContext.visitQueue (/apps/node_modules/@babel/traverse/lib/context.js:118:16)
    at TraversalContext.visitSingle (/apps/node_modules/@babel/traverse/lib/context.js:90:19)
    at TraversalContext.visit (/apps/node_modules/@babel/traverse/lib/context.js:146:19)
    at Function.traverse.node (/apps/node_modules/@babel/traverse/lib/index.js:94:17)
    at NodePath.visit (/apps/node_modules/@babel/traverse/lib/path/context.js:95:18)
    at TraversalContext.visitQueue (/apps/node_modules/@babel/traverse/lib/context.js:118:16)
    at TraversalContext.visitMultiple (/apps/node_modules/@babel/traverse/lib/context.js:85:17)
    at TraversalContext.visit (/apps/node_modules/@babel/traverse/lib/context.js:144:19)
    at Function.traverse.node (/apps/node_modules/@babel/traverse/lib/index.js:94:17)
    at NodePath.visit (/apps/node_modules/@babel/traverse/lib/path/context.js:95:18)
    at TraversalContext.visitQueue (/apps/node_modules/@babel/traverse/lib/context.js:118:16)```


like image 708
ka.tee.jean Avatar asked Jan 21 '19 21:01

ka.tee.jean


1 Answers

You need to add

plugins": [
"@babel/plugin-proposal-object-rest-spread"
]

to your .babelrc

like image 91
Saransh Kataria Avatar answered Nov 20 '22 15:11

Saransh Kataria