-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
109 lines (104 loc) · 2.78 KB
/
Copy pathvite.config.ts
File metadata and controls
109 lines (104 loc) · 2.78 KB
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
101
102
103
104
105
106
107
108
109
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
base: "/",
preview: {
port: 8080,
strictPort: true,
proxy: {
'/api': {
target: 'http://localhost:3002',
changeOrigin: true,
secure: false,
},
'/uploads': {
target: 'http://localhost:3002',
changeOrigin: true,
secure: false,
}
}
},
server: {
origin: "http://0.0.0.0:8080",
strictPort: true,
host: true,
port: 8080,
hmr: {
overlay: false
},
proxy: {
'/api': {
target: 'http://localhost:3002',
changeOrigin: true,
secure: false,
},
'/uploads': {
target: 'http://localhost:3002',
changeOrigin: true,
secure: false,
}
}
},
plugins: [
react(),
],
build: {
chunkSizeWarningLimit: 1000,
outDir: 'dist', // output directory
sourcemap: false, // disable source maps for production to save memory
minify: 'esbuild', // use esbuild for faster, less memory-intensive minification
rollupOptions: {
output: {
manualChunks: (id) => {
// External vendor packages
if (id.includes('node_modules')) {
if (id.includes('react') || id.includes('react-dom')) {
return 'vendor';
}
if (id.includes('@radix-ui')) {
return 'ui';
}
// Other large vendors
if (id.includes('lucide-react')) {
return 'icons';
}
return 'vendor';
}
// Force services into their own chunk to resolve dynamic/static import warnings
if (id.includes('/services/sqlite.svc') || id.includes('/services/email.svc')) {
return 'services';
}
// Group utility functions that use services
if (id.includes('/utils/currencyFormatting') ||
id.includes('/utils/dateFormatting') ||
id.includes('/utils/emailConfigUtils') ||
id.includes('/utils/invoiceNumbering')) {
return 'utils';
}
// Group all settings components together
if (id.includes('/components/settings/')) {
return 'settings';
}
// Group invoice components
if (id.includes('/components/invoices/')) {
return 'invoices';
}
},
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
esbuild: {
// Minimal optimization to save memory
treeShaking: true,
},
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
},
});