Files
tabby-web/webpack.config.js

94 lines
2.2 KiB
JavaScript
Raw Normal View History

2021-06-25 21:55:40 +02:00
const path = require('path')
const webpack = require('webpack')
const { AngularWebpackPlugin } = require('@ngtools/webpack')
2021-07-16 20:25:00 +02:00
const HtmlWebpackPlugin = require('html-webpack-plugin')
const htmlPluginOptions = {
hash: true,
minify: false
}
2021-06-25 21:55:40 +02:00
module.exports = {
target: 'web',
entry: {
index: path.resolve(__dirname, 'src/index.ts'),
terminal: path.resolve(__dirname, 'src/terminal.ts'),
},
mode: process.env.DEV ? 'development' : 'production',
context: __dirname,
2021-07-16 20:25:00 +02:00
devtool: 'source-map',
2021-06-25 21:55:40 +02:00
output: {
path: path.join(__dirname, 'build'),
pathinfo: true,
2021-07-16 20:25:00 +02:00
publicPath: '/static/',
2021-06-25 21:55:40 +02:00
filename: '[name].js',
chunkFilename: '[name].bundle.js',
},
2021-07-16 20:25:00 +02:00
cache: !process.env.DEV ? false : {
type: 'filesystem',
},
2021-06-25 21:55:40 +02:00
resolve: {
modules: [
'src/',
'node_modules/',
],
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.[jt]sx?$/,
loader: '@ngtools/webpack',
},
2021-07-06 23:45:52 +02:00
{ test: /tabby\/app\/dist/, use: ['script-loader'] },
2021-06-25 21:55:40 +02:00
{
test: /\.pug$/,
use: ['apply-loader', 'pug-loader'],
include: /component\.pug/
},
{
test: /\.scss$/,
2021-07-06 23:45:52 +02:00
use: ['@tabby-gang/to-string-loader', 'css-loader', 'sass-loader'],
2021-06-25 21:55:40 +02:00
include: /component\.scss/
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
exclude: /component\.scss/
},
{
test: /\.(ttf|eot|otf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
type: 'asset/resource',
},
{ test: /\.css$/, use: ['css-loader', 'sass-loader'] },
{
test: /\.(jpeg|png|svg)?$/,
type: 'asset/resource',
2021-07-16 20:25:00 +02:00
},
{
test: /\.html$/,
loader: 'html-loader',
},
2021-06-25 21:55:40 +02:00
],
},
plugins: [
new AngularWebpackPlugin({
tsconfig: 'tsconfig.main.json',
directTemplateLoading: false,
}),
2021-07-16 20:25:00 +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,
}),
2021-06-25 21:55:40 +02:00
],
}