【发布时间】:2020-03-06 09:49:45
【问题描述】:
我一直在使用 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 文件,正如我在谷歌上搜索错误时看到的那样,但问题相同
{
"presets": [
"@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
]
]
}
【问题讨论】: