【问题标题】:Why does `moduleName` in Webpack's stats include '+ 4 modules'?为什么 Webpack 统计中的 `moduleName` 包含 '+ 4 个模块'?
【发布时间】:2019-05-16 07:14:43
【问题描述】:

这是一个例子:

{
  "moduleId": 14,
  "moduleIdentifier": "/projects/sbt-vuefy/node_modules/vue-loader/lib/index.js??vue-loader-options!/projects/sbt-vuefy/src/test/scala/givers/vuefy/assets/vue/component-a.vue e03f6658ab7c5e6582e13283490782d2",
  "module": "./vue/component-a.vue + 4 modules",
  "moduleName": "./vue/component-a.vue + 4 modules",
  "type": "harmony import specifier",
  "userRequest": "./dependencies/component-b.vue",
  "loc": "7:29-39"
}

上面的 JSON 来自下面的 Webpack 插件代码:

class Plugin {
  apply(compiler) {
    compiler.hooks.emit.tap("emit-hook", (compilation) => {
      for (let module of compilation.getStats().toJson().modules) {
        for (let reason of module.reasons) {
          console.log(JSON.stringify(reason));
        }
      }
    });
  }
}

有人知道+ 4 modules 是什么意思吗?而且,更重要的是,有没有办法摆脱它?

官方文档 (https://webpack.js.org/api/stats/#module-objects) 没有说明任何内容。

谢谢

【问题讨论】:

    标签: vue.js webpack vue-loader


    【解决方案1】:

    这不是错误,可以关闭。见:https://github.com/webpack/webpack/issues/8507

    【讨论】:

      猜你喜欢
      • 2023-03-18
      • 2018-07-07
      • 1970-01-01
      • 2012-02-06
      • 2020-09-21
      • 1970-01-01
      • 2017-07-20
      • 2020-02-13
      • 2011-04-20
      相关资源
      最近更新 更多