Skip to content

Commit 5974ab8

Browse files
authored
Merge pull request #393 from embark-framework/bug_fix/js-files-not-watched
Fix glob in Windows for chokidar
2 parents 0cffff0 + 3266f20 commit 5974ab8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/pipeline/watch.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
let chokidar = require('chokidar');
22
let path = require('path');
3+
const _ = require('underscore');
34

45
let fs = require('../core/fs.js');
56

@@ -57,14 +58,16 @@ class Watch {
5758

5859
// workaround for imports issue
5960
// so embark reacts to changes made in imported js files
61+
// chokidar glob patterns only work with front-slashes
6062
if (!Array.isArray(files)) {
61-
fileGlob = path.join(path.dirname(files), '**', '*.*');
63+
fileGlob = path.join(path.dirname(files), '**', '*.*').replace(/\\/g, '/');
6264
} else if (files.length === 1) {
63-
fileGlob = path.join(path.dirname(files[0]), '**', '*.*');
65+
fileGlob = path.join(path.dirname(files[0]), '**', '*.*').replace(/\\/g, '/');
6466
}
6567

6668
filesToWatch.push(fileGlob);
6769
}
70+
filesToWatch = _.uniq(filesToWatch);
6871

6972
this.watchFiles(
7073
filesToWatch,

0 commit comments

Comments
 (0)