Bable配置decorator报错

配置:
"babel-core": "^6.17.0",

{  "plugins": [    "transform-class-properties",    "transform-es2015-block-scoping",
    ["transform-es2015-classes", {"loose": true}],    "transform-proto-to-assign",    
    "transform-decorators-legacy",    "transform-es2015-modules-commonjs"
  ],  "presets": [    "react",    "es2015",    "stage-0"
  ]
}

报错:

Method has decorators, put the decorator plugin before the classes one.


梦里花落0921
浏览 729回答 1
1回答

慕莱坞森

参考:babel-plugin-transform-decorators-legacyNOTE: Order of Plugins Matters!If you are including your plugins manually and using transform-class-properties, make sure that transform-decorators-legacy comes before transform-class-properties./// WRONG"plugins": [  "transform-class-properties",  "transform-decorators-legacy"]// RIGHT"plugins": [  "transform-decorators-legacy",  "transform-class-properties"]
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript