I would like for Webpack to log which file triggered my watch mode build.
I have configured a plugin that listens to the watch-run
compiler event hook l
The plugin I used for this in Webpack 4:
class WatchRunPlugin {
apply(compiler) {
compiler.hooks.watchRun.tap('WatchRun', (comp) => {
const changedTimes = comp.watchFileSystem.watcher.mtimes;
const changedFiles = Object.keys(changedTimes)
.map(file => `\n ${file}`)
.join('');
if (changedFiles.length) {
console.log("====================================")
console.log('NEW BUILD FILES CHANGED:', changedFiles);
console.log("====================================")
}
});
}
}