为了账号安全,请及时绑定邮箱和手机立即绑定

Bable配置decorator报错

Bable配置decorator报错

梦里花落0921 2018-10-16 13:18:43
配置:"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.
查看完整描述

1 回答

?
慕莱坞森

TA贡献1810条经验 获得超4个赞

参考:babel-plugin-transform-decorators-legacy

NOTE: 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"

]


查看完整回答
反对 回复 2018-11-06
  • 1 回答
  • 0 关注
  • 723 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信