且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

静态类属性不与Babel一起使用

更新时间:2023-09-19 10:43:40

类属性不属于ES2015规范,因此它们也不属于ES2015 Babel预设。 向该语言添加类属性的提议目前处于标准化的第二阶段过程,所以你需要第2阶段预设。

Class properties aren't part of the ES2015 spec, so they're not part of the ES2015 Babel preset either. The proposal to add class properties to the language is currently at Stage 2 of the standardization process, so you need the Stage 2 preset.

https://babeljs.io/docs/plugins/preset-stage-2/

或者,你可以安装这个课程属性插件本身:

Alternatively, you could just install the class properties plugin on its own:

http://babeljs.io/docs/plugins/transform-class-properties/