const folderPath = "./src/";
const pages = fs
.readdirSync(folderPath)
.map((filename) => filename)
.filter((filename) => filename.includes(".html"));
const multipleHtmlPlugins = pages.map((name) => {
const filename = path.basename(
path.resolve(__dirname, `${folderPath}${name}`)
);
return new HtmlWebpackPlugin({
template: path.resolve(__dirname, `${folderPath}${name}`),
filename,
minify: {
collapseWhitespace: isProd,
},
});
});