From 9df0ee9554373349d648fe126e9c3c664c5d12b9 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 21 Feb 2018 13:51:48 -0500 Subject: [PATCH] fix issue in which some files were not triggered change event --- lib/pipeline/watch.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/pipeline/watch.js b/lib/pipeline/watch.js index c82559a76..bf43a151a 100644 --- a/lib/pipeline/watch.js +++ b/lib/pipeline/watch.js @@ -1,4 +1,5 @@ let chokidar = require('chokidar'); +let path = require('path'); let fs = require('../core/fs.js'); @@ -37,7 +38,16 @@ class Watch { let filesToWatch = []; for (let targetFile in appConfig) { - filesToWatch.push(appConfig[targetFile]); + let files = appConfig[targetFile]; + let fileGlob = files; + + // workaround for imports issue + // so embark reacts to changes made in imported js files + if ((!Array.isArray(files) || files.length === 1)) { + fileGlob = path.join(path.dirname(files[0]), '**', '*.*'); + } + + filesToWatch.push(fileGlob); } this.watchFiles(