File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,11 @@ class MinifyHtmlWebpackPlugin {
74
74
}
75
75
76
76
const dir = this . options . dir || this . root ;
77
+ if ( ! dir ) {
78
+ console . error ( "Either missing base `dir` to find the files or the root of webpack context not provided." )
79
+ return ;
80
+ }
81
+
77
82
78
83
if ( ! this . options . src ) {
79
84
throw new Error ( '`src` is missing from the options.' )
@@ -103,13 +108,19 @@ class MinifyHtmlWebpackPlugin {
103
108
const afterBuild = this . options . afterBuild || false ;
104
109
this . root = compilation . options . context ;
105
110
if ( ! afterBuild ) {
111
+ if ( Array . isArray ( compilation . errors ) && compilation . errors . length > 0 ) {
112
+ return ;
113
+ }
106
114
this . process ( ) ;
107
115
}
108
116
} ) ;
109
117
110
- compiler . hooks . done . tap ( 'MinifyHtmlWebpackPluginAfterBuild' , compilation => {
118
+ compiler . hooks . done . tap ( 'MinifyHtmlWebpackPluginAfterBuild' , stats => {
111
119
const afterBuild = this . options . afterBuild || false ;
112
120
if ( afterBuild ) {
121
+ if ( stats && stats . compilation && Array . isArray ( stats . compilation . errors ) && stats . compilation . errors . length > 0 ) {
122
+ return ;
123
+ }
113
124
this . process ( ) ;
114
125
}
115
126
} )
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " minify-html-webpack-plugin" ,
3
- "version" : " 1.1.6 " ,
3
+ "version" : " 1.1.7 " ,
4
4
"description" : " A webpack plugin to minify html file(s) after building" ,
5
5
"scripts" : {
6
6
"test" : " echo \" Error: no test specified\" && exit 1"
You can’t perform that action at this time.
0 commit comments