2021-01-02 23:11:09 +00:00
|
|
|
const webpack = require('webpack');
|
2021-01-03 13:36:48 +00:00
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2021-01-02 23:11:09 +00:00
|
|
|
const path = require('path');
|
|
|
|
|
2021-01-03 13:46:40 +00:00
|
|
|
const root = path.resolve(__dirname, '..', '..');
|
2021-01-03 13:36:48 +00:00
|
|
|
|
|
|
|
function packPage(page, chunks) {
|
|
|
|
if (!chunks) chunks = [];
|
|
|
|
return new HtmlWebpackPlugin({
|
2021-01-03 13:37:55 +00:00
|
|
|
template: `${root}/src/templates/${page}`,
|
2021-01-03 13:36:48 +00:00
|
|
|
filename: `${root}/static/templates/${page}`,
|
|
|
|
chunks: chunks,
|
|
|
|
inject: false,
|
|
|
|
minify: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-01-02 23:11:09 +00:00
|
|
|
module.exports = {
|
2021-01-03 13:36:48 +00:00
|
|
|
entry: {
|
|
|
|
index: "./src/index.ts",
|
|
|
|
blah: "./src/blah.ts",
|
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
runtimeChunk: "single",
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'all',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mode: "development",
|
|
|
|
output: {
|
2021-01-03 13:46:40 +00:00
|
|
|
path: path.resolve(__dirname, 'dist'),
|
2021-01-03 13:36:48 +00:00
|
|
|
filename: '[name].bundle.js'
|
|
|
|
},
|
|
|
|
devtool: 'inline-source-map',
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.ts$/,
|
|
|
|
include: /src|_proto/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: "ts-loader"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: [".ts", ".js"]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
packPage('login.html.tera', ['index']),
|
|
|
|
packPage('base.html.tera'),
|
|
|
|
packPage('error.html.tera'),
|
|
|
|
packPage('index.html.tera'),
|
|
|
|
packPage('registration.html.tera'),
|
|
|
|
packPage('characters/edit_character.html.tera'),
|
|
|
|
packPage('characters/edit_character_macros.html.tera'),
|
|
|
|
packPage('characters/new_character.html.tera'),
|
|
|
|
packPage('characters/view_character.html.tera')
|
2021-01-02 23:11:09 +00:00
|
|
|
]
|
|
|
|
};
|