Skip to content

Commit 44c88a7

Browse files
authoredJul 20, 2024··
fix(dts): terminate worker when work is done (#1142)
1 parent 0f0b4b2 commit 44c88a7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,10 @@ export async function build(_options: Options) {
244244
})
245245
worker.on('message', (data) => {
246246
if (data === 'error') {
247+
worker.terminate()
247248
reject(new Error('error occured in dts build'))
248249
} else if (data === 'success') {
250+
worker.terminate()
249251
resolve()
250252
} else {
251253
const { type, text } = data

‎src/rollup.ts

-2
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ const startRollup = async (options: NormalizedOptions) => {
240240
} catch {
241241
parentPort?.postMessage('error')
242242
}
243-
parentPort?.close()
244243
}
245244
}
246245

@@ -250,7 +249,6 @@ parentPort?.on('message', (data) => {
250249
if (!hasTypescript) {
251250
logger.error('dts', `You need to install "typescript" in your project`)
252251
parentPort?.postMessage('error')
253-
parentPort?.close()
254252
return
255253
}
256254
startRollup(data.options)

0 commit comments

Comments
 (0)
Please sign in to comment.