You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you specify the watch option and set persistent: true, the watch will happen only for a single change event. I believe it is because of how watch.js is coded:
fs.watchFile(file, wopts, function (curr, prev) {
if (curr.mtime - prev.mtime == 0) return;
watchedFiles.forEach(function(file, i) { // <-- Unconditionally remove the watch
fs.unwatchFile(file);
delete watchedFiles[i];
});
if (opts.verbose) {
console.log('File change detected, regenerating bundle');
}
opts.listen.removeListener('close', unwatch);
opts.listen.emit('change', file);
});
As you can see, it unconditionally removes the watch from all the files when a single event comes in. Instead, I think it should be something of this form:
fs.watchFile(file, wopts, function (curr, prev) {
if (curr.mtime - prev.mtime == 0) return;
if (!wopts.persistent) {
watchedFiles.forEach(function(file, i) {
fs.unwatchFile(file);
delete watchedFiles[i];
});
}
if (opts.verbose) {
console.log('File change detected, regenerating bundle');
}
opts.listen.removeListener('close', unwatch);
opts.listen.emit('change', file);
});
Any thoughts?
The text was updated successfully, but these errors were encountered:
If you specify the
watch
option and setpersistent: true
, the watch will happen only for a single change event. I believe it is because of how watch.js is coded:As you can see, it unconditionally removes the watch from all the files when a single event comes in. Instead, I think it should be something of this form:
Any thoughts?
The text was updated successfully, but these errors were encountered: