作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我们得到 Trace:节点类型 RestProperty 已在我们的构建中重命名为 RestElement 警告。构建成功,但自从升级到 babel 7.0.0 后,出现了很多问题
我已经尝试过这里的解决方案Trace: The node type SpreadProperty has been renamed to SpreadElement at Object.isSpreadProperty但似乎并没有解决这个问题
相关的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)```
最佳答案
你需要添加
plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
到你的.babelrc
关于javascript - NPM 运行生成错误 : "Trace: The node type RestProperty has been renamed to RestElement" with new Babel 7. 0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54298330/
我是一名优秀的程序员,十分优秀!