11const WARMUP_BUILDS = 10 ;
2- const TOTAL_BUILDS = 20 ;
2+ const TOTAL_BUILDS = 110 ;
33
44module . exports = class BuildPlugin {
55 apply ( compiler ) {
@@ -8,22 +8,16 @@ module.exports = class BuildPlugin {
88 compiler . hooks . watchRun . tap ( "BuildPlugin" , ( ) => {
99 isWatching = true ;
1010 } ) ;
11- ( compiler . hooks . afterDone || compiler . hooks . done ) . tap ( "BuildPlugin" , ( ) => {
12- setTimeout ( ( ) => {
13- if ( counter === WARMUP_BUILDS ) console . log ( "#!# start" ) ;
14- if ( isWatching && counter <= TOTAL_BUILDS ) console . log ( "#!# next" ) ;
15- } , 10 ) ;
11+ compiler . hooks . afterDone . tap ( "BuildPlugin" , ( ) => {
12+ if ( counter === WARMUP_BUILDS ) console . log ( "#!# start" ) ;
13+ if ( isWatching && counter <= TOTAL_BUILDS ) console . log ( "#!# next" ) ;
1614 } ) ;
1715 compiler . hooks . done . tap ( "BuildPlugin" , stats => {
1816 if ( isWatching ) {
1917 counter ++ ;
2018 if ( counter <= WARMUP_BUILDS ) return ;
2119 if ( counter > TOTAL_BUILDS ) {
22- if ( compiler . watching ) {
23- compiler . watching . close ( ) ;
24- } else {
25- process . nextTick ( ( ) => process . exit ( 0 ) ) ;
26- }
20+ process . nextTick ( ( ) => process . exit ( 0 ) ) ;
2721 }
2822 }
2923 const { logging, time } = stats . toJson ( {
@@ -69,10 +63,7 @@ module.exports = class BuildPlugin {
6963 if ( type !== "time" ) return ;
7064 const ms = args [ 1 ] * 1000 + args [ 2 ] / 1000000 ;
7165 console . log (
72- `#!# ${ name } .${ args [ 0 ] . replace (
73- / r e s t o r e c a c h e c o n t e n t \d .+ $ / ,
74- "restore cache content"
75- ) } = ${ ms } `
66+ `#!# ${ name } .${ args [ 0 ] . replace ( / r e s t o r e c a c h e c o n t e n t \d .+ $ / , "restore cache content" ) } = ${ ms } `
7667 ) ;
7768 } ;
7869 }
0 commit comments