2016-09-22 23 views
0

將Babel與Webpack一起使用,並試圖讓發生器在某些反應代碼中工作。嘗試使用babel-runtimebabel-plugin-transform-runtime以便能夠使用ES6發電機,但我發現,當我火了我的本地開發服務器出現以下錯誤信息:模塊構建失敗:TypeError:插件「transform-runtime」未導出插件實例

Module build failed: TypeError: The plugin "transform-runtime" didn't export a Plugin instance

package.json包括以下

"dependencies": { 
    ... 
    "babel-core": "5.8.38", 
    "babel-loader": "5.0.0", 
    "babel-plugin-transform-runtime": "6.15.0", 
    "babel-preset-es2015": "6.14.0", 
    "babel-preset-react": "6.11.1", 
    "babel-preset-stage-2": "6.11.0", 
    "babel-runtime": "6.11.6", 
    ... 
} 

webpack.config.js包括以下

module: { 
    loaders: [ 
    { 
     ... 
     loader: 'babel-loader', 
     query: { 
     plugins: ['transform-runtime'] 
     } 
    }, 
    ... 
} 

任何想法,我做錯了什麼?

回答

1
"babel-runtime": "6.11.6", 

VS

"babel-core": "5.8.38", 

你的版本不匹配。由於你的大部分代表是Babel 6,你應該使用[email protected],與babel-loader相同。