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

在写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 enabled

原文地址:https://www.cnblogs.com/zcy9838/p/12017313.html

时间: 2024-08-30 05:55:15

webpack打包时报错:Support for the experimental syntax 'classProperties' isn't currently enabled的相关文章

react+mobx+antd按需加载 出现Support for the experimental syntax 'decorators-legacy' isn't currently enabled

baidu上面的说法大多是在 项目的package.json 中添加decorators-legacy 因为引入了antd的按需加载 所以只需要在config-overrides.js中添加addDecoratorsLegacy() const { override, fixBabelImports,addDecoratorsLegacy } = require('customize-cra'); module.exports = override( fixBabelImports('impor

Support for the experimental syntax 'decorators-legacy' isn't currently enabled (7:1):

1.产生原因:项目不支持装饰器 2.解决方法: 2.1 执行 yarn 安装完整依赖: 2.2 如果依赖时yarn.lock变化了,并且项目有git目录,则将提示的文件提交到git仓库 ? Are you sure you want to eject? This action is permanent. Yes This git repository has untracked files or uncommitted changes: yarn.lock 2.3 执行: yarn eject

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

错误提示如下: operator (>) 表示这个运算符 (>) 有问题. 打开对应的emitter.js文件,可以看到有段es6的语法不解析. 我们需要在配置文件webpack.base.conf.js把这个文件加入到babel-loader的解析规则中 这样再执行打包命令就正常啦! 原文地址:https://www.cnblogs.com/xuweijin/p/8889652.html

解决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:

app打包时报错unable to execute command: Segmentation fault: 11

问题:打包时报错   clang: error:unable to execute command: Segmentation fault: 11 clang: error:linker command failed due to signal (use -v to see invocation) app在上架的时候遇到这个报错问题,一开始以为是证书或者是配置描述文件哪里出错了.作为新手,在试了好多方法依然无法解决之后,只能无奈按照app上架流程又完完全全的重新过了一遍,在点击Archive后的

webpack 打包报错:One CLI for webpack must be installed. These are recommended choices, delivered as separate packages

webpack 打包报错: One CLI for webpack must be installed. These are recommended choices, delivered as separate packages: 解决办法: 全局.局部安装个遍!具体什么原因还不清楚... 先全局安装webpack和webpack-clinpm install webpack -gnpm install webpack-cli -g再局部安装webpack和webpack-clinpm inst

关于Webpack打包报错Class constructor FileManager cannot be invoked witchout 'new'

前端代码部署一直是自己打包之后将文件用FileZilla上传到服务器上,现在改用运维基于到k8s docker镜像的发布,前端打包报错如下: 经查资料,报错原因是less升级导致的Bug 尝试升级less-loader到5.0.0已解决上面问题. 关于Webpack打包报错Class constructor FileManager cannot be invoked witchout 'new' 原文地址:https://www.cnblogs.com/vikki7/p/11392744.htm

在使用npm打包时报错 Tip: built files are meant to be served over an HTTP server. Opening index.html over file:// won't work.

npm run dev是开发环境 (尚在编码过程中) npm run build 是生产环境(完成编码) 因为vue-cli的默认配置中, publishPath是用绝对目录, 所以dist文件夹里的文件必须放在服务器的根目录, 如果你想本地打开的话, 可以在npm run build完成之后执行以下命令: npm install -g http-server 只需执行一次 . 在使用npm打包时报错 Tip: built files are meant to be served over an

ionic2 打包时报错 file-opener2

在app自动更新过程中,有用到ionic-native插件:cordova-plugin-file-openner2    添加插件后,打包时有错: FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android'. > Could not resolve all dependencies for configuration ':_de