javascript - Bable配置decorator报错
天蓬老师
天蓬老师 2017-04-11 10:58:18
0
1
665

配置:
"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.

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

répondre à tous(1)
迷茫

参考: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"
]
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!