This repository has been archived by the owner on Jun 19, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.ts
100 lines (99 loc) · 2.67 KB
/
webpack.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import VueLoaderPlugin from 'vue-loader/lib/plugin';
import HtmlPlugin from 'html-webpack-plugin';
import { resolve } from 'path';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
export default {
devServer: {
historyApiFallback: true,
},
mode: 'development',
parallelism: 4,
entry: {
panel: './src/panel/index.ts',
login: './src/login/index.ts',
oauth: './src/login/index.ts',
public: './src/public/index.ts',
overlays: './src/overlays/index.ts',
},
output: {
path: resolve(__dirname, 'public', 'dest'),
publicPath: '/static/',
filename: '[name].[contenthash].js',
chunkFilename: '[name].[contenthash].js',
pathinfo: false,
},
performance: { hints: false },
optimization: {
minimize: true,
minimizer: [new TerserPlugin(), new CssMinimizerPlugin()],
},
module: {
rules: [
{
test: /\.vue$/i,
loader: 'vue-loader',
},
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.ts$/i,
use: {
loader: 'ts-loader',
options: { experimentalFileCaching: true, appendTsSuffixTo: [/\.vue$/] },
},
},
],
},
plugins: [
new CleanWebpackPlugin({
dangerouslyAllowCleanPatternsOutsideProject: true,
}),
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
chunkFilename: '[id].[contenthash].css',
}),
new HtmlPlugin({
filename: '../panel.html',
template: 'src/panel/index.html',
chunks: ['panel'],
}),
new HtmlPlugin({
filename: '../login.html',
template: 'src/login/index.html',
chunks: ['login'],
}),
new HtmlPlugin({
filename: '../oauth.html',
template: 'src/oauth/index.html',
chunks: ['oauth'],
}),
new HtmlPlugin({
filename: '../public.html',
template: 'src/public/index.html',
chunks: ['public'],
}),
new HtmlPlugin({
filename: '../overlays.html',
template: 'src/overlays/index.html',
chunks: ['overlays'],
}),
],
resolve: {
extensions: ['.ts', '.js', '.vue'],
alias: {
vue$: 'vue/dist/vue.esm.js',
'@': resolve(__dirname, 'src'),
'@src': resolve(__dirname, 'src'),
'@bot': resolve(__dirname, 'src', 'bot'),
'@panel': resolve(__dirname, 'src', 'panel'),
'@login': resolve(__dirname, 'src', 'login'),
},
fallback: { querystring: require.resolve('querystring-es3') },
},
};