gpt4 book ai didi

javascript - "loose": true is not fixing Support for the experimental syntax 'classProperties' isn't currently enabled

转载 作者:行者123 更新时间:2023-11-29 18:40:58 27 4
gpt4 key购买 nike

Support for the experimental syntax 'classProperties' isn't currently enabled

我尝试了重新构建后仍然出现错误的解决方案。

Support for the experimental syntax 'classProperties' isn't currently enabled

package.json

{
"name": "blahmodule",
"version": "1.0.0",
"description": "a fetch module for our project",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "./node_modules/.bin/babel src --out-file index.js"
},
"peerDependencies": {
"react": "^16.6.6",
"react-dom": "^16.6.3",
"axios": "^0.19.0"
},
"author": "",
"license": "ISC",
"dependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.4.4",
"axios": "^0.19.0"
}
}

.babelrc

{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
]
]
}

最佳答案

我正在使用 plugin-proposal-class-properties 并且它有效,这是我的 JSON 配置文件 .babelrc

{
"presets": ["@babel/preset-env"],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{"loose": true}
]
]
}

关于javascript - "loose": true is not fixing Support for the experimental syntax 'classProperties' isn't currently enabled,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56813044/

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