From 44c88a7410919fed1455c8dd1a0d9513f1231b0d Mon Sep 17 00:00:00 2001 From: Grigory Date: Sat, 20 Jul 2024 23:30:36 +0500 Subject: [PATCH] fix(dts): terminate worker when work is done (#1142) --- src/index.ts | 2 ++ src/rollup.ts | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index c9af0fd20..a00102d32 100644 --- a/src/index.ts +++ b/src/index.ts @@ -244,8 +244,10 @@ export async function build(_options: Options) { }) worker.on('message', (data) => { if (data === 'error') { + worker.terminate() reject(new Error('error occured in dts build')) } else if (data === 'success') { + worker.terminate() resolve() } else { const { type, text } = data diff --git a/src/rollup.ts b/src/rollup.ts index cc8ae9524..37fe23583 100644 --- a/src/rollup.ts +++ b/src/rollup.ts @@ -240,7 +240,6 @@ const startRollup = async (options: NormalizedOptions) => { } catch { parentPort?.postMessage('error') } - parentPort?.close() } } @@ -250,7 +249,6 @@ parentPort?.on('message', (data) => { if (!hasTypescript) { logger.error('dts', `You need to install "typescript" in your project`) parentPort?.postMessage('error') - parentPort?.close() return } startRollup(data.options)