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) {
|
2021-01-04 22:36:21 +00:00
|
|
|
if (!chunks) chunks = [];
|
|
|
|
return new HtmlWebpackPlugin({
|
|
|
|
template: `${root}/src/templates/${page}`,
|
|
|
|
filename: `${root}/static/templates/${page}`,
|
|
|
|
publicPath: '/scripts/dist',
|
|
|
|
scriptLoading: 'defer',
|
|
|
|
chunks: chunks,
|
|
|
|
inject: false,
|
|
|
|
minify: false
|
|
|
|
});
|
2021-01-03 13:36:48 +00:00
|
|
|
}
|
|
|
|
|
2021-01-02 23:11:09 +00:00
|
|
|
module.exports = {
|
2021-01-04 22:36:21 +00:00
|
|
|
entry: {
|
|
|
|
edit_character: "./src/characters/edit.ts",
|
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
runtimeChunk: "single",
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'all',
|
2021-01-03 13:36:48 +00:00
|
|
|
},
|
2021-01-04 22:36:21 +00:00
|
|
|
},
|
|
|
|
mode: "development",
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, 'dist'),
|
|
|
|
filename: '[name].bundle.js'
|
|
|
|
},
|
|
|
|
devtool: 'inline-source-map',
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.ts$/,
|
|
|
|
include: /src|_proto/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: "ts-loader"
|
|
|
|
}
|
2021-01-02 23:11:09 +00:00
|
|
|
]
|
2021-01-04 22:36:21 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: [".ts", ".js"]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
2021-01-05 21:25:26 +00:00
|
|
|
packPage('login.html.tera'),
|
2021-01-04 22:36:21 +00:00
|
|
|
packPage('base.html.tera'),
|
|
|
|
packPage('error.html.tera'),
|
|
|
|
packPage('index.html.tera'),
|
|
|
|
packPage('registration.html.tera'),
|
|
|
|
packPage('characters/edit_character.html.tera', ['edit_character']),
|
|
|
|
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
|
|
|
};
|