File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,12 @@ export async function build(_options: Options) {
222
222
if ( options . dts ) {
223
223
await new Promise < void > ( ( resolve , reject ) => {
224
224
const worker = new Worker ( path . join ( __dirname , './rollup.js' ) )
225
+
226
+ const terminateWorker = ( ) => {
227
+ if ( options . watch ) return
228
+ worker . terminate ( )
229
+ }
230
+
225
231
worker . postMessage ( {
226
232
configName : item ?. name ,
227
233
options : {
@@ -238,10 +244,10 @@ export async function build(_options: Options) {
238
244
} )
239
245
worker . on ( 'message' , ( data ) => {
240
246
if ( data === 'error' ) {
241
- worker . terminate ( )
247
+ terminateWorker ( )
242
248
reject ( new Error ( 'error occured in dts build' ) )
243
249
} else if ( data === 'success' ) {
244
- worker . terminate ( )
250
+ terminateWorker ( )
245
251
resolve ( )
246
252
} else {
247
253
const { type, text } = data
You can’t perform that action at this time.
0 commit comments