Skip to content

Commit

Permalink
fix(dts): terminate worker when work is done (#1142)
Browse files Browse the repository at this point in the history
  • Loading branch information
SunsetTechuila authored Jul 20, 2024
1 parent 0f0b4b2 commit 44c88a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ const startRollup = async (options: NormalizedOptions) => {
} catch {
parentPort?.postMessage('error')
}
parentPort?.close()
}
}

Expand All @@ -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)
Expand Down

0 comments on commit 44c88a7

Please sign in to comment.