prevent infinite loop in build watcher

This commit is contained in:
Konnor Rogers
2025-07-18 00:33:42 -04:00
parent 36b21b0be7
commit e6de71bc1b

View File

@@ -386,10 +386,14 @@ export async function build(options = {}) {
},
);
const watchEvents = ['change', 'unlink', 'add'];
const watchEvents = [
'change',
'unlink',
'add'
];
// Rebuild and reload when source files change
options.watchedSrcDirectories.forEach(dir => {
const watcher = bs.watch(join(dir, '**', '!(*.test).*'));
const watcher = bs.watch(join(dir, '**', '!(*.test).*'), { ignoreInitial: true });
watchEvents.forEach(evt => {
watcher.on(evt, handleWatchEvent(evt));
@@ -456,7 +460,7 @@ export async function build(options = {}) {
// Rebuild the docs and reload when the docs change
options.watchedDocsDirectories.forEach(dir => {
const watcher = bs.watch(join(dir, '**', '*.*'));
const watcher = bs.watch(join(dir, '**', '*.*'), { ignoreInitial: true });
watchEvents.forEach(evt => {
watcher.on(evt, handleWatchEvent(evt));