mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 22:34:24 +00:00
Merge pull request #393 from embark-framework/bug_fix/js-files-not-watched
Fix glob in Windows for chokidar
This commit is contained in:
commit
5974ab81bf
@ -1,5 +1,6 @@
|
|||||||
let chokidar = require('chokidar');
|
let chokidar = require('chokidar');
|
||||||
let path = require('path');
|
let path = require('path');
|
||||||
|
const _ = require('underscore');
|
||||||
|
|
||||||
let fs = require('../core/fs.js');
|
let fs = require('../core/fs.js');
|
||||||
|
|
||||||
@ -57,14 +58,16 @@ class Watch {
|
|||||||
|
|
||||||
// workaround for imports issue
|
// workaround for imports issue
|
||||||
// so embark reacts to changes made in imported js files
|
// so embark reacts to changes made in imported js files
|
||||||
|
// chokidar glob patterns only work with front-slashes
|
||||||
if (!Array.isArray(files)) {
|
if (!Array.isArray(files)) {
|
||||||
fileGlob = path.join(path.dirname(files), '**', '*.*');
|
fileGlob = path.join(path.dirname(files), '**', '*.*').replace(/\\/g, '/');
|
||||||
} else if (files.length === 1) {
|
} else if (files.length === 1) {
|
||||||
fileGlob = path.join(path.dirname(files[0]), '**', '*.*');
|
fileGlob = path.join(path.dirname(files[0]), '**', '*.*').replace(/\\/g, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
filesToWatch.push(fileGlob);
|
filesToWatch.push(fileGlob);
|
||||||
}
|
}
|
||||||
|
filesToWatch = _.uniq(filesToWatch);
|
||||||
|
|
||||||
this.watchFiles(
|
this.watchFiles(
|
||||||
filesToWatch,
|
filesToWatch,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user