This commit is contained in:
Eugene Pankov
2021-07-16 20:25:00 +02:00
parent 6d4ae3b4c3
commit 2c95a15609
18 changed files with 379 additions and 137 deletions

View File

@@ -1,24 +1,32 @@
const path = require('path')
const webpack = require('webpack')
const { AngularWebpackPlugin } = require('@ngtools/webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const htmlPluginOptions = {
hash: true,
minify: false
}
module.exports = {
target: 'web',
entry: {
'index.ignore': 'file-loader?name=index.html!pug-html-loader!' + path.resolve(__dirname, './src/index.pug'),
index: path.resolve(__dirname, 'src/index.ts'),
'terminal.ignore': 'file-loader?name=terminal.html!pug-html-loader!' + path.resolve(__dirname, './src/terminal.pug'),
terminal: path.resolve(__dirname, 'src/terminal.ts'),
},
mode: process.env.DEV ? 'development' : 'production',
context: __dirname,
devtool: 'cheap-module-source-map',
devtool: 'source-map',
output: {
path: path.join(__dirname, 'build'),
pathinfo: true,
publicPath: '/static/',
filename: '[name].js',
chunkFilename: '[name].bundle.js',
},
cache: !process.env.DEV ? false : {
type: 'filesystem',
},
resolve: {
modules: [
'src/',
@@ -56,7 +64,11 @@ module.exports = {
{
test: /\.(jpeg|png|svg)?$/,
type: 'asset/resource',
}
},
{
test: /\.html$/,
loader: 'html-loader',
},
],
},
@@ -65,5 +77,17 @@ module.exports = {
tsconfig: 'tsconfig.main.json',
directTemplateLoading: false,
}),
new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
chunks: ['index'],
...htmlPluginOptions,
}),
new HtmlWebpackPlugin({
template: './src/terminal.html',
filename: 'terminal.html',
chunks: ['terminal'],
...htmlPluginOptions,
}),
],
}