From dfe2edc5a560d5f480f6d2a862d891b38963fc45 Mon Sep 17 00:00:00 2001 From: Bruce Berrios <58147810+Bruception@users.noreply.github.com> Date: Wed, 6 Apr 2022 11:05:19 -0400 Subject: [PATCH] Refactor plugin code (#2808) Bruception --- frontend/webpack/config.base.js | 40 +++++++++++++-------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/frontend/webpack/config.base.js b/frontend/webpack/config.base.js index 6de66fc39..575d469b3 100644 --- a/frontend/webpack/config.base.js +++ b/frontend/webpack/config.base.js @@ -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", }),