-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
91 lines (82 loc) · 1.9 KB
/
index.js
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
import TerserPlugin from "terser-webpack-plugin";
import { dirname, resolve as _resolve, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// noinspection JSUnresolvedVariable
export default {
mode: process.env.production ? "production" : "development",
devtool: process.env.production ? "source-map" : "inline-source-map",
output: {
path: join(__dirname, 'static/assets/dist'),
},
watch: true,
watchOptions: {
aggregateTimeout: 200,
poll: 1000,
ignored: '**/node_modules',
},
target: ["browserslist"],
stats: "minimal",
performance: {
maxEntrypointSize: 400000,
maxAssetSize: 250000,
hints: "warning",
},
optimization: {
minimize: !!process.env.production,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
},
},
extractComments: false,
}),
],
emitOnErrors: true,
moduleIds: "deterministic",
runtimeChunk: "single",
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "all",
},
},
},
mangleWasmImports: true,
mangleExports: "deterministic",
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
loader: "babel-loader",
test: /\.js?$/,
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader", "postcss-loader"],
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: "asset/resource",
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
};