From 1b71f26965461511a887d6cb91082b0c343ffeaa Mon Sep 17 00:00:00 2001 From: Jon Erling Hustadnes Date: Tue, 2 Dec 2025 15:42:14 +0100 Subject: [PATCH] fix(build.ts/startWatching): add option `awaitWriteFinish` with 250ms threshold This makes it so that the events are not fired until the file have stabilized. This also changes the order of the fired events. A move / rename now results in `delete` then `add` rather than the other way around. From `chokidar` README - https://github.com/paulmillr/chokidar?tab=readme-ov-file#performance: ``` awaitWriteFinish.stabilityThreshold (default: 2000). Amount of time in milliseconds for a file size to remain constant before emitting its event. ``` Fixes #2232 --- quartz/build.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/quartz/build.ts b/quartz/build.ts index f3adfe250..b98f4a8a0 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -143,6 +143,7 @@ async function startWatching( } const watcher = chokidar.watch(".", { + awaitWriteFinish: { stabilityThreshold: 250 }, persistent: true, cwd: argv.directory, ignoreInitial: true,