Files
tabby-web/frontend/webpack.config.js

55 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-07-25 14:00:22 +02:00
const baseConfig = require('./webpack.config.base.js')
2021-06-25 21:55:40 +02:00
const path = require('path')
2021-07-25 17:44:43 +02:00
const webpack = require('webpack')
2021-06-25 21:55:40 +02:00
const { AngularWebpackPlugin } = require('@ngtools/webpack')
2021-07-24 20:25:09 +02:00
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
2021-07-25 14:00:22 +02:00
const HtmlWebpackPlugin = require('html-webpack-plugin')
const htmlPluginOptions = {
hash: true,
minify: false
}
const outputPath = path.join(__dirname, 'build')
2021-07-24 20:25:09 +02:00
2021-07-24 20:38:07 +02:00
module.exports = {
2021-07-25 14:00:22 +02:00
name: 'browser',
target: 'web',
...baseConfig,
entry: {
2021-07-24 20:38:07 +02:00
index: path.resolve(__dirname, 'src/index.ts'),
terminal: path.resolve(__dirname, 'src/terminal.ts'),
2021-07-25 14:00:22 +02:00
},
plugins: [
2021-07-24 20:38:07 +02:00
...baseConfig.plugins,
new AngularWebpackPlugin({
2021-07-24 20:25:09 +02:00
tsconfig: 'tsconfig.json',
directTemplateLoading: false,
2021-09-13 09:54:00 +02:00
jitMode: false,
2021-07-24 20:38:07 +02:00
}),
2021-07-25 14:00:22 +02:00
new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
chunks: ['index'],
...htmlPluginOptions,
}),
new HtmlWebpackPlugin({
template: './src/terminal.html',
filename: 'terminal.html',
chunks: ['terminal'],
...htmlPluginOptions,
}),
],
output: {
path: outputPath,
2021-07-24 20:38:07 +02:00
pathinfo: true,
2021-07-26 17:56:35 +02:00
publicPath: '/static/',
2021-07-24 20:38:07 +02:00
filename: '[name].js',
chunkFilename: '[name].bundle.js',
2021-07-25 14:00:22 +02:00
},
2021-07-24 20:38:07 +02:00
}
2021-07-24 20:25:09 +02:00
if (process.env.BUNDLE_ANALYZER) {
2021-09-15 20:38:18 +02:00
module.exports.plugins.push(new BundleAnalyzerPlugin())
2021-07-24 20:25:09 +02:00
}