Skip to content

Commit 49c11c3

Browse files
committedAug 2, 2024·
fix: do not terminate dts worker in watch mode, closes #1172, closes #1171
1 parent e9ee083 commit 49c11c3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/index.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ export async function build(_options: Options) {
222222
if (options.dts) {
223223
await new Promise<void>((resolve, reject) => {
224224
const worker = new Worker(path.join(__dirname, './rollup.js'))
225+
226+
const terminateWorker = () => {
227+
if (options.watch) return
228+
worker.terminate()
229+
}
230+
225231
worker.postMessage({
226232
configName: item?.name,
227233
options: {
@@ -238,10 +244,10 @@ export async function build(_options: Options) {
238244
})
239245
worker.on('message', (data) => {
240246
if (data === 'error') {
241-
worker.terminate()
247+
terminateWorker()
242248
reject(new Error('error occured in dts build'))
243249
} else if (data === 'success') {
244-
worker.terminate()
250+
terminateWorker()
245251
resolve()
246252
} else {
247253
const { type, text } = data

0 commit comments

Comments
 (0)
Please sign in to comment.