File tree 2 files changed +22
-8
lines changed
2 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 41
41
. option ( '--minimal' , 'Generate minimal output whenever possible' )
42
42
. option ( '--banner' , 'Add banner with pkg info to the bundle' )
43
43
. option ( '--no-async-pro, --no-async-to-promises' , 'Leave async/await as is' )
44
+ . option ( '--concurrent' , 'Build concurrently' )
44
45
. option ( '--verbose' , 'Show verbose logs' )
45
46
. option ( '--quiet' , 'Show minimal logs' )
46
47
. option ( '--stack-trace' , 'Show stack trace for bundle errors' )
82
83
}
83
84
)
84
85
await bundler
85
- . run ( { write : true , watch : options . watch } )
86
+ . run ( {
87
+ write : true ,
88
+ watch : options . watch ,
89
+ concurrent : options . concurrent
90
+ } )
86
91
. catch ( ( err : any ) => {
87
92
bundler . handleError ( err )
88
93
process . exit ( 1 )
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ process.env.BUILD = 'production'
40
40
interface RunOptions {
41
41
write ?: boolean
42
42
watch ?: boolean
43
+ concurrent ?: boolean
43
44
}
44
45
45
46
interface RunContext {
@@ -340,7 +341,6 @@ export class Bundler {
340
341
plugins . push ( {
341
342
name : 'record-bundle' ,
342
343
generateBundle ( outputOptions , _assets ) {
343
- logger . success ( title . replace ( 'Bundle' , 'Bundled' ) )
344
344
const EXTS = [
345
345
outputOptions . entryFileNames
346
346
? path . extname ( outputOptions . entryFileNames )
@@ -365,6 +365,7 @@ export class Bundler {
365
365
}
366
366
} ,
367
367
async writeBundle ( ) {
368
+ logger . success ( title . replace ( 'Bundle' , 'Bundled' ) )
368
369
await printAssets ( assets )
369
370
}
370
371
} )
@@ -538,12 +539,20 @@ export class Bundler {
538
539
} )
539
540
} else {
540
541
try {
541
- await waterfall (
542
- tasks . map ( task => ( ) => {
543
- return this . build ( task , context , options . write )
544
- } ) ,
545
- context
546
- )
542
+ if ( options . concurrent ) {
543
+ await Promise . all (
544
+ tasks . map ( task => {
545
+ return this . build ( task , context , options . write )
546
+ } )
547
+ )
548
+ } else {
549
+ await waterfall (
550
+ tasks . map ( task => ( ) => {
551
+ return this . build ( task , context , options . write )
552
+ } ) ,
553
+ context
554
+ )
555
+ }
547
556
} catch ( err ) {
548
557
spinner . stop ( )
549
558
throw err
You can’t perform that action at this time.
0 commit comments