我们得到了跟踪:在我们的构建中,节点类型RestProperty已重命名为RestElement警告。构建成功,但是自升级到babel 7.0.0以来,还有很多这样的构建
我在这里Trace: The node type SpreadProperty has been renamed to SpreadElement at Object.isSpreadProperty尝试过解决方案,但似乎无法解决此问题
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)```
答案 0 :(得分:1)
就我而言,以下解决方案有效:
package-lock.json
。rm -rf node_modules
。npm i
npm run buld
成功了!
答案 1 :(得分:0)
您需要添加
plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
到您的.babelrc