-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
69 lines (68 loc) · 2.27 KB
/
vite.config.ts
File metadata and controls
69 lines (68 loc) · 2.27 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
import path from 'path';
import { defineConfig, loadEnv } from 'vite';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, '.', '');
return {
base: '/Walid-PassAnalyzer/',
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
}
},
build: {
// Enable code splitting
rollupOptions: {
output: {
manualChunks: {
// Separate vendor libraries
'vendor-crypto': ['zxcvbn'],
'vendor-pdf': ['jspdf'],
// Separate React and DOM
'react-vendor': ['react', 'react-dom'],
// Separate services
'services': [
'./services/CryptoService.ts',
'./services/DictionaryService.ts',
'./services/PasswordAnalysisService.ts',
'./services/ClipboardService.ts',
'./services/ExportService.ts'
],
// Separate components by feature
'generator-components': [
'./components/PasswordGenerator.tsx',
'./components/PassphraseGenerator.tsx'
],
'comparison-components': [
'./components/PasswordComparison.tsx',
'./components/ComparisonInput.tsx',
'./components/ComparisonResults.tsx'
],
'dictionary-components': [
'./components/DictionaryManager.tsx'
]
}
}
},
// Optimize chunk size
chunkSizeWarningLimit: 1000,
// Enable minification
minify: 'terser',
terserOptions: {
compress: {
drop_console: mode === 'production',
drop_debugger: mode === 'production',
pure_funcs: mode === 'production' ? ['console.log', 'console.info'] : []
}
},
// Enable source maps for debugging
sourcemap: mode !== 'production'
},
// Optimize dependencies
optimizeDeps: {
include: ['react', 'react-dom', 'zxcvbn'],
exclude: ['jspdf'] // Load PDF library on demand
}
// If you have a 'plugins' array (e.g., for React or Vue), it would go here too.
// plugins: [react()],
};
});