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)