簡體   English   中英

模塊構建失敗:TypeError:插件“transform-runtime”沒有導出插件實例

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

在 Webpack 中使用 Babel 並嘗試讓生成器在一些 React 代碼中工作。 嘗試使用babel-runtimebabel-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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM