【发布时间】:2017-08-25 17:09:23
【问题描述】:
我想让 Webpack 记录哪个文件触发了我的监视模式构建。
我已经配置了一个像这样监听watch-run 编译器事件钩子的插件:
function() {
this.plugin("watch-run", function(watching, callback) {
// maybe something in `watching` will indicate the changed file?
// when I find out what it is, `console.log` it here
callback();
});
}
// Example output: "/Users/aaron/git/test/index.js" was changed, new build triggered
但我无法确定更改的文件信息可能在哪里,如果有的话。
Webpack 文档在这方面确实缺乏。 Compiler Event Hook 页面没有任何示例(只有一条消息说明示例即将推出),old v1 documentation 在详细阐述 watching/compiler 对象中可用的属性/方法方面并没有好多少.
任何帮助或指导将不胜感激。
【问题讨论】:
标签: file logging build webpack watch