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(