File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,24 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {
58
58
return sharedState [ this . options . name ] ;
59
59
}
60
60
61
+ apply ( compiler ) {
62
+ super . apply ( compiler ) ;
63
+
64
+ const hook = ( stats ) => {
65
+ this . state . stats = stats ;
66
+ if ( ! hasRunning ( ) ) {
67
+ this . logUpdate . clear ( ) ;
68
+ this . done ( ) ;
69
+ }
70
+ } ;
71
+
72
+ if ( compiler . hooks ) {
73
+ compiler . hooks . done . tap ( 'WebpackBar' , hook ) ;
74
+ } else {
75
+ compiler . plugin ( 'done' , hook ) ;
76
+ }
77
+ }
78
+
61
79
done ( ) {
62
80
if ( this . options . profile ) {
63
81
const stats = this . state . profile . getStats ( ) ;
@@ -86,6 +104,7 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {
86
104
87
105
if ( ! wasRunning && isRunning ) {
88
106
// Started
107
+ delete this . state . stats ;
89
108
this . state . start = process . hrtime ( ) ;
90
109
if ( this . options . minimal ) {
91
110
consola . info ( `Compiling ${ this . options . name } ` ) ;
@@ -110,12 +129,7 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {
110
129
this . state . profile . onRequest ( this . state . request ) ;
111
130
}
112
131
113
- if ( hasRunning ( ) ) {
114
- this . _render ( ) ;
115
- } else {
116
- this . logUpdate . clear ( ) ;
117
- this . done ( ) ;
118
- }
132
+ this . _render ( ) ;
119
133
}
120
134
121
135
render ( ) {
You can’t perform that action at this time.
0 commit comments