Skip to content

Commit 9d6f111

Browse files
committed
fix: prevent rebuild hang
1 parent 8db8d06 commit 9d6f111

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/lib/bundle/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ function ensureWorker() {
5252
return bundleWorker;
5353
}
5454

55+
function resetWorker(error: Error) {
56+
rejectPendingRequests(error);
57+
bundleWorker?.terminate();
58+
bundleWorker = null;
59+
}
60+
5561
export async function bundle(files: SourceFile[], version: string): Promise<BundleResult> {
62+
resetWorker(new Error("Bundle request superseded by a newer request"));
63+
5664
const worker = ensureWorker();
5765
const id = nextRequestId++;
5866

0 commit comments

Comments
 (0)