我遇到了一个问题,即我现有的代码停止工作,我无法解决问题的原因,我有一个非常简单的程序可以转换ES6代码:
TypeError: The plugin "transform-es2015-modules-commonjs" didn't export a Plugin instance
at PluginManager.validate (C:\Epam\dhl-ewf\cq\dhl-view\src\main\content\jcr_root\etc\clientlibs\dhl\global\node_modules\babel-core\lib\transformation\file\plugin-manager.js:164:13)
at PluginManager.add (C:\Epam\dhl-ewf\cq\dhl-view\src\main\content\jcr_root\etc\clientlibs\dhl\global\node_modules\babel-core\lib\transformation\file\plugin-manager.js:213:10)
at File.buildTransformers (C:\Epam\dhl-ewf\cq\dhl-view\src\main\content\jcr_root\etc\clientlibs\dhl\global\node_modules\babel-core\lib\transformation\file\index.js:237:21)
at new File (C:\Epam\dhl-ewf\cq\dhl-view\src\main\content\jcr_root\etc\clientlibs\dhl\global\node_modules\babel-core\lib\transformation\file\index.js:139:10)
at Pipeline.transform (C:\Epam\dhl-ewf\cq\dhl-view\src\main\content\jcr_root\etc\clientlibs\dhl\global\node_modules\babel-core\lib\transformation\pipeline.js:164:16)
at load (C:\Epam\dhl-ewf\cq\dhl-view\src\main\content\jcr_root\etc\clientlibs\dhl\global\Es6\index.js:63:26)
at Object.jsdom.env.done (C:\Epam\dhl-ewf\cq\dhl-view\src\main\content\jcr_root\etc\clientlibs\dhl\global\Es6\index.js:216:5)
at C:\Epam\dhl-ewf\cq\dhl-view\src\main\content\jcr_root\etc\clientlibs\dhl\global\Es6\node_modules\jsdom\lib\jsdom.js:271:18
at nextTickCallbackWith0Args (node.js:433:9)
at process._tickCallback (node.js:362:13)
我的代码不具代表性,它停在以下行:
let transpiled = babel.transform(source, {
"plugins": [
'transform-es2015-modules-commonjs',
'transform-es2015-destructuring',
'transform-es2015-parameters',
'transform-es2015-spread'
] });
可能是什么问题?提前谢谢!
答案 0 :(得分:4)
您正尝试将Babel 6插件与Babel 5一起使用。