From 2281e4bfda9b91c4a83d63bfc8df8372d1e6ae9e Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Thu, 26 Mar 2020 11:07:17 +0100 Subject: [PATCH] fix: don't remove trailing slashes from self closing tags by default --- index.js | 5 +++-- spec/basic.spec.js | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index e6779f5f..764e0fc6 100644 --- a/index.js +++ b/index.js @@ -115,10 +115,11 @@ class HtmlWebpackPlugin { const minify = this.options.minify; if (minify === true || (minify === 'auto' && isProductionLikeMode)) { - /** @type { import('html-minifier').Options } */ + /** @type { import('html-minifier-terser').Options } */ this.options.minify = { - // https://github.com/kangax/html-minifier#options-quick-reference + // https://www.npmjs.com/package/html-minifier-terser#options-quick-reference collapseWhitespace: true, + keepClosingSlash: true, removeComments: true, removeRedundantAttributes: true, removeScriptTypeAttributes: true, diff --git a/spec/basic.spec.js b/spec/basic.spec.js index 5d706c47..5e95725a 100644 --- a/spec/basic.spec.js +++ b/spec/basic.spec.js @@ -2304,4 +2304,27 @@ describe('HtmlWebpackPlugin', () => { ] }, [/