[英]Babel plugin “transform-runtime” only works after first compile
[英]Module build failed: TypeError: The plugin "transform-runtime" didn't export a Plugin instance
在 Webpack 中使用 Babel 並嘗試讓生成器在一些 React 代碼中工作。 嘗試使用babel-runtime
和babel-plugin-transform-runtime
來啟用 ES6 生成器的使用,但是當我啟動本地開發服務器時收到以下錯誤消息:
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']
}
},
...
}
關於我做錯了什么的任何想法?
"babel-runtime": "6.11.6",
對比
"babel-core": "5.8.38",
你的版本不匹配。 由於你的大部分 deps 都是 Babel 6,你應該使用babel-core@6
,同樣的babel-loader
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.