Skip to content

Commit 054afe9

Browse files
committed
Fix Watcher with postcss-imports
For setups with multiple entry points (ie: two or more), the `updateWatchedFiles` func would 'unwatch' files imported by the first entrypoint when resolving imports of the next. To fix this I have modified the `updateWatchedFiles` func to never explicitally unwatch any sources but instead only add new sources which were not already being watched.
1 parent 2d9c50f commit 054afe9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,14 @@ function fsWatcher(entryPoints) {
166166
return files.concat(index[entryPoint]);
167167
}, []);
168168
// update watch list
169-
watcher.unwatch(watchedFiles);
169+
var newSources = [];
170+
sources.forEach(function (src) {
171+
if (watchedFiles.indexOf(src) === -1) {
172+
newSources.push(src);
173+
}
174+
});
170175
watcher.add(sources);
171-
watchedFiles = sources;
176+
watchedFiles = watchedFiles.concat(newSources);
172177
};
173178
}
174179

0 commit comments

Comments
 (0)