From 10194fe4456773be38ee9c06598979d6ba630b12 Mon Sep 17 00:00:00 2001 From: fooness <11408027+fooness@users.noreply.github.com> Date: Tue, 18 May 2021 12:35:51 +0200 Subject: [PATCH] Prevent minification of `.html` files generated by new verison html-webpack-plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This described in https://github.com/vector-im/element-web/issues/17330#issuecomment-842530812, this should prevent the newly introduced version of `html-webpack-plugin` from minifying `.html` files, like e.g. `index.html`, `jitsi.html`, et cetera … Quoting @jryans via: https://github.com/vector-im/element-web/issues/17330#issuecomment-842415694 > The content of the `index.html` file is not a supported API surface, so it might change at any time. > > This document minification was not done on purpose, but instead it happened as a side effect of upgrading. We would happily accept a PR to fix this, but it is also not a priority for the core team. Could please someone test and, hopefully, accept this change back to not minifying the `.html` files? --- webpack.config.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 9d7fa703d9..07fcb4f671 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -386,7 +386,7 @@ module.exports = (env, argv) => { // of the themes and which chunks we actually care about. inject: false, excludeChunks: ['mobileguide', 'usercontent', 'jitsi'], - minify: argv.mode === 'production', + minify: false, templateParameters: { og_image_url: ogImageUrl, }, @@ -396,7 +396,7 @@ module.exports = (env, argv) => { new HtmlWebpackPlugin({ template: './src/vector/jitsi/index.html', filename: 'jitsi.html', - minify: argv.mode === 'production', + minify: false, chunks: ['jitsi'], }), @@ -404,7 +404,7 @@ module.exports = (env, argv) => { new HtmlWebpackPlugin({ template: './src/vector/mobile_guide/index.html', filename: 'mobile_guide/index.html', - minify: argv.mode === 'production', + minify: false, chunks: ['mobileguide'], }), @@ -412,13 +412,13 @@ module.exports = (env, argv) => { new HtmlWebpackPlugin({ template: './src/vector/static/unable-to-load.html', filename: 'static/unable-to-load.html', - minify: argv.mode === 'production', + minify: false, chunks: [], }), new HtmlWebpackPlugin({ template: './src/vector/static/incompatible-browser.html', filename: 'static/incompatible-browser.html', - minify: argv.mode === 'production', + minify: false, chunks: [], }), @@ -426,7 +426,7 @@ module.exports = (env, argv) => { new HtmlWebpackPlugin({ template: './node_modules/matrix-react-sdk/src/usercontent/index.html', filename: 'usercontent/index.html', - minify: argv.mode === 'production', + minify: false, chunks: ['usercontent'], }),