File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -99,8 +99,12 @@ class HtmlWebpackPlugin {
99
99
this . options . filename = path . relative ( compiler . options . output . path , filename ) ;
100
100
}
101
101
102
+ // Check if webpack is running in production mode
103
+ // @see https://github.com/webpack/webpack/blob/3366421f1784c449f415cda5930a8e445086f688/lib/WebpackOptionsDefaulter.js#L12-L14
104
+ const isProductionLikeMode = compiler . options . mode === 'production' || ! compiler . options . mode ;
105
+
102
106
const minify = this . options . minify ;
103
- if ( minify === true || ( minify === undefined && compiler . options . mode === 'production' ) ) {
107
+ if ( minify === true || ( minify === undefined && isProductionLikeMode ) ) {
104
108
this . options . minify = {
105
109
// https://github.com/kangax/html-minifier#options-quick-reference
106
110
collapseWhitespace : true ,
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ interface HtmlWebpackPluginOptions {
53
53
* HTML Minification options
54
54
* @https ://github.com/kangax/html-minifier#options-quick-reference
55
55
*/
56
- minify : undefined | boolean | { } ,
56
+ minify ?: boolean | { } ,
57
57
cache : boolean ,
58
58
/**
59
59
* Render errors into the HTML page
You can’t perform that action at this time.
0 commit comments