fix(compiler): yield to the event loop after TypeScript emit to allow pending microtasks and I/O to settle before reading or modifying the output directory
This commit is contained in:
@@ -244,6 +244,12 @@ export class TsCompiler {
|
||||
|
||||
// If no pre-emit errors, proceed with emit
|
||||
const emitResult = program.emit();
|
||||
|
||||
// Yield to the event loop so any pending microtasks, nextTick callbacks,
|
||||
// or deferred I/O from TypeScript's emit (e.g. libuv write completions)
|
||||
// can settle before we read or modify the output directory.
|
||||
await new Promise<void>((resolve) => process.nextTick(resolve));
|
||||
|
||||
const emitErrorSummary = this.processDiagnostics(emitResult.diagnostics);
|
||||
|
||||
// Combine error summaries
|
||||
|
||||
Reference in New Issue
Block a user