-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (43 loc) · 1008 Bytes
/
webpack.config.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
import path from 'path';
import TerserPlugin from 'terser-webpack-plugin';
export default {
entry: './src/index.ts',
output: {
filename: 'index.js',
path: path.resolve('./dist'), // 使用 __dirname 来确保路径正确
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
CalendarCode: path.resolve( './dist/CalendarCode'),
},
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
optimization: {
minimize: false, // 启用压缩
usedExports: false, // 禁用未使用导出的优化
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
comments: false, // 去除注释
},
compress: {
// drop_console: true, // 删除 console.* 语句
passes: 2,
},
},
}),
],
},
target: 'node',
mode: 'production', // 确保在生产模式下启用压缩
};