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.将性能和错误量化.因为自己平时喜欢吃菠萝,所以就取名叫菠萝系统.其实在很早以前就有这个想法,当时已经实现了前端的参 ...
随机推荐
- append和push和pop区别
append() 操作的是DOM节点,在被选元素的结尾(内部结尾)插入指定内容: push() 向数组末尾插入一个或者多个元素,并且返回新的长度: pop() 删除 ...
- 编写javad代码实现使用Scanner从键盘读取一行输入,去掉其中重复字符, 打印出不同的那些字符
package com.loaderman.test; import java.util.HashSet; import java.util.Scanner; public class Test2 { ...
- iOS 应用"无法安装应用程序 因为证书无效"的解决方案
原因是由于iOS7.1要安装企业应用,url必须是https的,不能是http,这就要求我们的服务器要支持https.因此,只要将原链接: itms-services://?action=downlo ...
- wmic查询ip
@echo off for /F "usebackq" %%R in (`wmic PATH Win32_NetworkAdapterConfiguration WHERE &qu ...
- windows下打开.ipynb文件
windows下打开.ipynb文件1.首先要下载python,设置环境变量2.下载pip,设置环境变量3.打开命令行,进入到python的Scripts文件中,按顺序执行下面三个命令pip inst ...
- BeanFactory 和FactoryBean的区别
转自:https://www.cnblogs.com/aspirant/p/9082858.html BeanFacotry是spring中比较原始的Factory.如XMLBeanFactory就是 ...
- HDU 1203 I NEED A OFFER! (动态规划、01背包、概率)
I NEED A OFFER! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- 2019icpc南昌邀请赛B Polynomial (拉格朗日插值法)
题目链接:https://nanti.jisuanke.com/t/40254 题意: 思路: 这题要用到拉格朗日插值法,网上查了一下,找到一份讲得特别好的: -------------------- ...
- Array of Doubled Pairs
Given an array of integers A with even length, return true if and only if it is possible to reorder ...
- 【转贴】GS464/GS464E
GS464/GS464E GS464为四发射64位结构,采用动态流水线.其1.0版本(简称GS464)为9级流水线结构,在龙芯3A.3B.2H中使用.其2.0版本(简称GS464E)为12级动态流水线 ...