fix issue in which some files were not triggered change event

This commit is contained in:
Iuri Matias 2018-02-21 13:51:48 -05:00
parent 671bf58433
commit 9df0ee9554
1 changed files with 11 additions and 1 deletions

View File

@ -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(