-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
68 lines (62 loc) · 1.61 KB
/
vite.config.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
import { defineConfig } from "vite";
import { resolve } from "path";
export default defineConfig({
build: {
// Library build configuration
lib: {
// Entry point for the library
entry: resolve(__dirname, "src/index.ts"),
// Global variable name when used in browser
name: "BigDecimal",
// Output file name without extension
fileName: "big-decimal",
},
// Rollup specific options
rollupOptions: {
// No external dependencies
external: [],
output: {
// No global dependencies
globals: {},
// Minify internal exports for smaller bundle
minifyInternalExports: true,
// Disable code splitting for libraries
manualChunks: undefined,
},
},
// Use modern JS features for better minification
target: "esnext",
// Use Terser for minification
minify: "terser",
// Terser minification options
terserOptions: {
compress: {
// Number of compression passes
passes: 2,
// Remove unreachable code
dead_code: true,
// Remove console.* calls
drop_console: true,
// Remove debugger statements
drop_debugger: true,
},
mangle: {
properties: {
// Mangle private properties starting with underscore
regex: /^_/,
},
},
format: {
// Remove all comments from output
comments: false,
},
},
},
// Path aliases configuration
resolve: {
alias: {
// Map '@' to src directory for imports
"@": resolve(__dirname, "./src"),
},
},
});