File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,22 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {
35
35
apply ( compiler ) {
36
36
super . apply ( compiler ) ;
37
37
38
- compiler . hooks . done . tap ( 'webpackbar' , ( ) => {
39
- logUpdate . clear ( ) ;
38
+ if ( compiler . hooks ) {
39
+ // Webpack >= 4
40
+ compiler . hooks . done . tap ( 'webpackbar' , ( ) => this . done ( ) ) ;
41
+ } else {
42
+ // Webpack < 4
43
+ compiler . plugin ( 'done' , ( ) => this . done ( ) ) ;
44
+ }
45
+ }
40
46
41
- if ( this . options . profile ) {
42
- const stats = sharedState [ this . options . name ] . profile . getStats ( ) ;
43
- printStats ( stats ) ;
44
- }
45
- } ) ;
47
+ done ( ) {
48
+ logUpdate . clear ( ) ;
49
+
50
+ if ( this . options . profile ) {
51
+ const stats = sharedState [ this . options . name ] . profile . getStats ( ) ;
52
+ printStats ( stats ) ;
53
+ }
46
54
}
47
55
48
56
updateProgress ( percent , msg , details ) {
You can’t perform that action at this time.
0 commit comments