Client: Simplify config for HtmlWebpackPlugin

This commit is contained in:
Ilya Oleshko 2024-02-19 12:24:08 +03:00
parent d2ff42627b
commit 0367a8a8be

View File

@ -321,51 +321,45 @@ module.exports = (env, argv) => {
...deps, ...deps,
...sharedDeps, ...sharedDeps,
}, },
}) }),
); );
const htmlTemplate = {
title: title,
template: "./public/index.html",
publicPath: homepage,
base: `${homepage}/`,
};
if (!!env.hideText) { if (!!env.hideText) {
config.plugins.push( htmlTemplate.custom = `
new HtmlWebpackPlugin({ <style type="text/css">
title: title, div,
template: "./public/index.html", p,
publicPath: homepage, a,
base: `${homepage}/`, span,
custom: `<style type="text/css"> button,
div, h1,
p, h2,
a, h3,
span, h4,
button, h5,
h1, h6,
h2, ::placeholder {
h3, color: rgba(0, 0, 0, 0) !important;
h4,
h5,
h6,
::placeholder {
color: rgba(0, 0, 0, 0) !important;
} }
</style>`, </style>`;
})
);
} else { } else {
config.plugins.push( htmlTemplate.browserDetectorUrl = `/static/scripts/browserDetector.js?hash=${
new HtmlWebpackPlugin({ runtime.checksums["browserDetector.js"] || dateHash
template: "./public/index.html", }`;
publicPath: homepage, htmlTemplate.configUrl = `/static/scripts/config.json?hash=${
title: title, runtime.checksums["config.json"] || dateHash
base: `${homepage}/`, }`;
browserDetectorUrl: `/static/scripts/browserDetector.js?hash=${
runtime.checksums["browserDetector.js"] || dateHash
}`,
configUrl: `/static/scripts/config.json?hash=${
runtime.checksums["config.json"] || dateHash
}`,
})
);
} }
config.plugins.push(new HtmlWebpackPlugin(htmlTemplate));
const defines = { const defines = {
VERSION: JSON.stringify(version), VERSION: JSON.stringify(version),
BUILD_AT: DefinePlugin.runtimeValue(function () { BUILD_AT: DefinePlugin.runtimeValue(function () {