What is the problem with the configuration of transform-class-properties?

transform-class-properties mainly solves the problem that is not supported by defaultProps= {} in the declaration of using class in es6.

needs to be escaped using stage-0 or the plug-in.

< H2 > question: < / H2 >

{

spec:true //false

}

< H2 > reference: official original link. I don"t understand < / H2 >

https://babeljs.io/docs/plugi.

Mar.07,2021

in fact, the subject can write a script and run for a while:

1.js

babel 1.js -o 1.false.js 
babel 1.js -o 1.true.js  //  `spec`

compare the two generated files, in fact, as written in the document:

when spec is true ,

  1. replaces assignment operations such as title="a" with Object.defineProperty .
  2. static variables ( cover ) are created even if they do not have an initial value.
Menu