解决Webpack中提示syntax 'classProperties' isn't currently enabled的错误

当我们使用了一些JavaScript的一些新特性的时候,但是有没有在webpack.config.js里面或者是.babelrc文件中配置相关插件,就可以解决了。

error:Support for the experimental syntax 'classProperties' isn't currently enable

  

解决方案:安装如下插件

npm i -D @babel/plugin-proposal-class-properties

在babelrc中配置插件:

options: {
        plugins: ['@babel/plugin-proposal-class-properties']
         }
       },

  

再次运行程序,发现之前的问题就没有了。

原文地址:https://www.cnblogs.com/52tech/p/9942170.html