diff --git a/lib/index.js b/lib/index.js index e7e64a7..d6fd542 100644 --- a/lib/index.js +++ b/lib/index.js @@ -6,7 +6,7 @@ const chokidar = require("chokidar"); function createPreprocessor(options, preconfig, basePath, emitter, logger) { const log = logger.create("preprocessor.rollup"); - const watch = new Watch(emitter); + const watch = new Watch(emitter, log); let cache; @@ -19,6 +19,7 @@ function createPreprocessor(options, preconfig, basePath, emitter, logger) { .then(bundle => { cache = bundle; watch.capture(bundle); + log.info("Generating bundle"); return bundle.generate(config); }) .then(({ code, map }) => { @@ -45,11 +46,14 @@ function createPreprocessor(options, preconfig, basePath, emitter, logger) { }; } -function Watch(emitter) { +function Watch(emitter, log) { this.buffer = new Set(); this.watchList = new Set(); this.watch = chokidar.watch(); - this.watch.on("change", () => emitter.refreshFiles()); + this.watch.on("change", () => { + log.info('Change detected'); + emitter.refreshFiles(); + }); emitter.on("run_start", () => this.start()); }