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
In webpack 4 you can access to watcher
in that way:
getChangedFiles(compiler) {
const { watchFileSystem } = compiler;
const watcher = watchFileSystem.watcher || watchFileSystem.wfs.watcher;
return Object.keys(watcher.mtimes);
}
latter in watchRun hook
compiler.hooks.watchRun.tapAsync('plugin name', (_compiler, done) => {
const changedFile = this.getChangedFiles(_compiler)
// ...
return done();
});