我一直在使用react.js,这是第一次发生,正在开发使用parcel-bundler设置的应用程序的前端,当我编写简单的jsx代码时遇到了这个问题。
Support for the experimental syntax 'classproperties' isn't currently enabled (15:13):
13 | }
14 |
> 15 | getcars = () => {
| ^
16 | console.log('hi')
17 | }
我尝试安装@ babel / plugin-proposal-class-properties并设置一个.babelrc文件,如我在Google搜索错误但同样的问题时所看到的那样
{
"presets": [
"@babel/preset-react"
],"plugins": [
[
"@babel/plugin-proposal-class-properties",{
"loose": true
}
]
]
}