... } could not be cloned"-6ren"> ... } could not be cloned"-更新: 该错误似乎与我拥有的 .babelrc 文件有关: { "presets": ["env", "react"], "plugins": ["transform-class-pr-6ren">
gpt4 book ai didi

JavaScript index.js .babelrc 错误 "Do not clone comments tha...... } could not be cloned"

转载 作者:行者123 更新时间:2023-12-04 11:44:54 26 4
gpt4 key购买 nike

更新:
该错误似乎与我拥有的 .babelrc 文件有关:

{
"presets": ["env", "react"],
"plugins": ["transform-class-properties", "transform-object-rest-spread"]
}
当我删除此文件时,错误消失。
原帖:
我正在将 React 与 Parcel-bundler 一起使用。
首先,我遇到了一个问题,这与我的包裹版本和 @babel/preset-env 不兼容(无效版本:未定义)有关。
我通过在 package.json 文件中添加分辨率标签来强制使用不需要版本对象的先前版本的 Babel 来解决。
这有效,但现在我在构建客户端时收到以下错误
npm run clean && parcel build client/src/index.html --out-dir client/dist :

.../client/src/index.js: function __clone() {var node2 = new Node();for (var key in this) {// Do not clone comments tha...omitted... } could not be cloned.


...

at Object.serialize (v8.js:202:7)


我在这里和谷歌搜索,但在任何地方都找不到这个错误。
知道那可能是什么吗?
作为引用,这里有一些 package.json 的摘录:
"dependencies": {
"babel-core": "^6.26.3",
"body-parser": "^1.18.3",
"elliptic": "^6.4.1",
"express": "^4.16.3",
"hex-to-binary": "^1.0.1",
"history": "^4.7.2",
"npm-force-resolutions": "0.0.10",
"parcel-bundler": "^1.10.3",
"pubnub": "^4.21.6",
"react": "^16.6.0",
"react-bootstrap": "^0.32.4",
"react-dom": "^16.6.0",
"react-router-dom": "^4.3.1",
"redis": "^2.8.0",
"request": "^2.88.0",
"uuid": "^3.3.2"
},
"resolutions": {
"@babel/preset-env": "7.13.8"
}

and

"devDependencies": {
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"cross-env": "^5.2.0",
"jest": "^23.6.0",
"nodemon": "^1.18.4"}



最佳答案

谢谢你。我整个周末都在尝试解决这个问题,只是删除了.babelrc,然后在运行'parcel index.html'后替换它,似乎已经修复了它。 Parcel 7+ 声称不再需要 babel 配置,因此在 .babelrc 中设置它可能会混淆初始克隆过程。

关于JavaScript index.js .babelrc 错误 "Do not clone comments tha...<omitted>... } could not be cloned",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66833922/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com