From 3266f20a0fb293a461e87c00a4f2970ed6bc2654 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 2 May 2018 15:48:06 -0400 Subject: [PATCH] fix glob in windows --- lib/pipeline/watch.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/pipeline/watch.js b/lib/pipeline/watch.js index 8ece7a5650..1f3fc14038 100644 --- a/lib/pipeline/watch.js +++ b/lib/pipeline/watch.js @@ -1,5 +1,6 @@ let chokidar = require('chokidar'); let path = require('path'); +const _ = require('underscore'); let fs = require('../core/fs.js'); @@ -57,14 +58,16 @@ class Watch { // workaround for imports issue // so embark reacts to changes made in imported js files + // chokidar glob patterns only work with front-slashes if (!Array.isArray(files)) { - fileGlob = path.join(path.dirname(files), '**', '*.*'); + fileGlob = path.join(path.dirname(files), '**', '*.*').replace(/\\/g, '/'); } 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 = _.uniq(filesToWatch); this.watchFiles( filesToWatch,