webpack打包时报错:Support for the experimental syntax 'classProperties' isn't currently enabl

Posted 浮华夕颜

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了webpack打包时报错:Support for the experimental syntax 'classProperties' isn't currently enabl相关的知识,希望对你有一定的参考价值。

在写react项目创建class时使用了静态属性,但是在打包的时候报错:

 根据报错提示下载@babel/plugin-proposal-class-properties包,并在.babelrc文件中的"plugins"里添加一项"@babel/plugin-proposal-class-properties"

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

重新打包即可。

以上是关于webpack打包时报错:Support for the experimental syntax 'classProperties' isn't currently enabl的主要内容,如果未能解决你的问题,请参考以下文章

webpack 找不到模块的问题求助

webpack打包时报错ERROR in static/js/vendor.35f3cd6381fdca8d6f5b.js from UglifyJs

解决Maven打包时报错"The packaging for this project did not assign a file to the build artifact"(示

javah生成jni头文件时报错 Error: cannot access android.support...

解决webpack运行npx webpack-dev-server时报错

安装webpack后,执行webpack -v命令时报错:SyntaxError: Block-sc