41 lines
712 B
JavaScript
41 lines
712 B
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
const pages = ["index", "aes"];
|
|
|
|
module.exports = {
|
|
mode: 'development',
|
|
entry: pages.reduce((config, page) => {
|
|
config[page] = `./src/${page}.js`;
|
|
return config;
|
|
}, {}),
|
|
output: {
|
|
filename: "[name].js",
|
|
path: path.resolve(__dirname, "dist"),
|
|
},
|
|
optimization: {
|
|
splitChunks: {
|
|
chunks: "all",
|
|
},
|
|
},
|
|
plugins: [].concat(
|
|
pages.map(
|
|
(page) =>
|
|
new HtmlWebpackPlugin({
|
|
inject: true,
|
|
template: `./src/pages/${page}.html`,
|
|
filename: `${page}.html`,
|
|
chunks: [page],
|
|
})
|
|
)
|
|
),
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.css$/i,
|
|
use: ['style-loader', 'css-loader'],
|
|
},
|
|
],
|
|
},
|
|
};
|