lincd-cli
Version:
Command line tools for the lincd.js library
45 lines (44 loc) • 1.6 kB
JavaScript
// WebpackWatchRunPlugin.js
/*
* This simple webpack plugin helps to identify the list of file changes, that
* triggered webpack re-compilation/re-build
*/
;
Object.defineProperty(exports, "__esModule", { value: true });
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('====================================');
}
});
}
}
/*class WebpackWatchRunPlugin {
constructor(options?) {
if (typeof options !== "object") options = {};
this['options'] = options;
}
apply(compiler) {
const options = this['options'];
compiler.plugin("watch-run",
function (watching, done) {
const changedTimes = watching.compiler.watchFileSystem.watcher.mtimes;
const changedFiles = Object.keys(changedTimes)
.map(file => `\n ${file}`)
.join("");
if (changedFiles.length) {
console.log("Files modified:", changedFiles);
}
done();
});
}
}*/
exports.default = WatchRunPlugin;
//# sourceMappingURL=watch-run.js.map