Support for the experimental syntax 'classProperties' isn't currently enabled
项目中使用高级语法报错,
报错信息
SyntaxError: E:\workdata\webpackVue\src\index.js: Support for the experimental syntax 'classProperties' isn't currently enabled (22:8):
20 |
21 | class Dog {
> 22 | name = 'bigWhite'
| ^
23 | static color = 'yellow'
24 | }
25 | const d = new Dog()
Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
这是因为在js中写了高级语法,浏览器不支持,需要安装babel插件,并配置,这里报错信息会提示我们安装插件
在项目中安装 npm i @babel/plugin-proposal-class-properties -D
在.babelrc文件中配置
"presets": [
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
配置后就能正常运行,并且也会转化为普通语法
Support for the experimental syntax 'classProperties' isn't currently enabled的更多相关文章
- 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 y ...
- 解决Webpack中提示syntax 'classProperties' isn't currently enabled的错误
当我们使用了一些JavaScript的一些新特性的时候,但是有没有在webpack.config.js里面或者是.babelrc文件中配置相关插件,就可以解决了. error:Support for ...
- error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler op
caffe c++11编译问题 问题:error: #error This file requires compiler and library support for the ISO C++ 201 ...
- React踩坑记
一: Support for the experimental syntax 'classProperties' isn't currently enabled ERROR in ./src/inde ...
- ES6入门一:ES6简介及Babel转码器
ES6简介 Babel转码器 Nodejs中使用ES6 WebPack中使用ES6及Babel转码插件 一.ES6简介与转码 1.1一个常见的问题,ECMAScript和JavaScript到底是什 ...
- ES6入门六:class的基本语法、继承、私有与静态属性、修饰器
基本语法 继承 私有属性与方法.静态属性与方法 修饰器(Decorator) 一.基本语法 class Grammar{ constructor(name,age){ //定义对象自身的方法和属性 t ...
- 26、前端知识点--利用webpack搭建脚手架一套完整流程
前言 我们的目标是利用webpack搭建一个基于react + react-router +dva + es6 + less + antd用于中后台开发的脚手架,同学们可能会说社区里那么多优秀的脚手架 ...
- babel plugin
a = () => {}, // Support for the experimental syntax 'classProperties' isn't currently enabled ya ...
- Node.js躬行记(4)——自建前端监控系统
这套前端监控系统用到的技术栈是:React+MongoDB+Node.js+Koa2.将性能和错误量化.因为自己平时喜欢吃菠萝,所以就取名叫菠萝系统.其实在很早以前就有这个想法,当时已经实现了前端的参 ...
随机推荐
- nginx的root 指令
好长时间都没搞清nginx的root路径: location /img/ { alias /var/www/image/; } #若按照上述配置的话,则访问/img/目录里面的文件时,ningx会自动 ...
- matplotlib之直方图
1.知识点 1.通过数据和组距得到组数 2.使用plt.hist(数据,组数)绘制频数直方图:使用plt.hist(数据,组数,normed=True)绘制频率直方图 3.使用plt.xticks(a ...
- Redis集群配置和常见异常解决
前文 Redis的Cluster集群,是在分布式且开源环境下最佳的高可用解决方案,可以有效的解决服务器宕机下或高并发下,数据的完整性. 文档前提 Redis 3.0版本或更高版本.(3.0版本开始支持 ...
- springboot启动报错:Failed to configure a DataSource
一.背景 springboot的出现,让项目搭建变得更方便快捷,同时简化掉很多的样板化配置代码,提高开发效率. 通过idea生成springboot项目,启动报错:Failed to configur ...
- 小D课堂 - 新版本微服务springcloud+Docker教程_2_01传统架构演进到分布式架构
笔记 第二章 架构演进和分布式系统基础知识 1.传统架构演进到分布式架构 简介:讲解单机应用和分布式应用架构演进基础知识 (画图) 高可用 LVS+keepalive :负载均衡的知识点 1. ...
- TensorFlow 用神经网络解决非线性问题
本节涉及点: 激活函数 sigmoid 产生随机训练数据 使用随机训练数据训练 加入偏移量b加快训练过程 进阶:批量生产随机训练数据 在前面的三好学生问题中,学校改变了评三好的标准 —— 总分> ...
- PJzhang:国外主流站点钓鱼网站示例工具shellphish
猫宁!!! 参考链接:https://www.uedbox.com/post/58583/ 这个是这个项目的github地址 https://github.com/thelinuxchoice/she ...
- 华为HCNA乱学Round 11:PPPOE
- hadoop的单机配置
hadoop的单机配置 准备工作 利用vim /etc/sysconfig/network命令修改主机名称. Ssh security shell 远程登录 登录远程服务器 $ ssh user@ho ...
- postman测试webservice接口