【发布时间】: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