插件“transform-class-properties”没有导出插件实例

时间:2016-01-27 14:41:16

标签: babeljs

我愿意使用Babel使用ES6 / 7 transform class properties功能。 按照提到的步骤here。我创建了一个包含内容的.babelrc文件:

{
  "plugins": ["transform-class-properties"]
}

执行webpack -p时出现以下错误:

ERROR in ./src/main.js
Module build failed: TypeError: The plugin "transform-class-properties" didn't export a Plugin instance
    at PluginManager.validate (../node_modules/babel-core/lib/transformation/file/plugin-manager.js:164:13)

任何想法都错了吗? 感谢。

1 个答案:

答案 0 :(得分:2)

transform-class-properties是一个Babel 6插件,你试图将它与Babel 5一起使用。在Babel 5中,你会这样做

"optional": ["es7.classProperties"]

或更新为Babel 6.