Refactor plugin code (#2808) Bruception

This commit is contained in:
Bruce Berrios 2022-04-06 11:05:19 -04:00 committed by GitHub
parent 89f7c360f4
commit dfe2edc5a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,20 @@ const RemovePlugin = require("remove-files-webpack-plugin");
let circularImports = 0;
const htmlWebpackPlugins = [
"terms-of-service",
"security-policy",
"privacy-policy",
"email-handler",
"das",
].map((name) => {
return new HtmlWebpackPlugin({
filename: `${name}.html`,
template: resolve(__dirname, `../static/${name}.html`),
inject: false,
});
});
/** @type { import('webpack').Configuration } */
const BASE_CONFIG = {
entry: {
@ -95,31 +109,7 @@ const BASE_CONFIG = {
template: resolve(__dirname, "../static/index.html"),
inject: "body",
}),
new HtmlWebpackPlugin({
filename: "terms-of-service.html",
template: resolve(__dirname, "../static/terms-of-service.html"),
inject: false,
}),
new HtmlWebpackPlugin({
filename: "security-policy.html",
template: resolve(__dirname, "../static/security-policy.html"),
inject: false,
}),
new HtmlWebpackPlugin({
filename: "email-handler.html",
template: resolve(__dirname, "../static/email-handler.html"),
inject: false,
}),
new HtmlWebpackPlugin({
filename: "privacy-policy.html",
template: resolve(__dirname, "../static/privacy-policy.html"),
inject: false,
}),
new HtmlWebpackPlugin({
filename: "das.html",
template: resolve(__dirname, "../static/das.html"),
inject: false,
}),
...htmlWebpackPlugins,
new MiniCssExtractPlugin({
filename: "./css/style.[chunkhash:8].css",
}),