diff --git a/packages/cli/src/lingui-extract.ts b/packages/cli/src/lingui-extract.ts index f8b837ff4..6972b08de 100644 --- a/packages/cli/src/lingui-extract.ts +++ b/packages/cli/src/lingui-extract.ts @@ -176,9 +176,14 @@ if (require.main === module) { const changedPaths = new Set() let debounceTimer: NodeJS.Timer + let previousExtract = Promise.resolve(true) const dispatchExtract = (filePath?: string[]) => { - // Skip debouncing if not enabled - if (!program.debounce) return extract(filePath) + // Skip debouncing if not enabled but still chain them so no racing issue + // on deleting the tmp folder. + if (!program.debounce) { + previousExtract = previousExtract.then(() => extract(filePath)) + return previousExtract + } filePath?.forEach((path) => changedPaths.add(path))