-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.ts
More file actions
85 lines (70 loc) · 2.14 KB
/
vite.config.ts
File metadata and controls
85 lines (70 loc) · 2.14 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
import react from '@vitejs/plugin-react'
import path from 'path'
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
// Prevent Vite from clearing console (useful for debugging)
clearScreen: false,
// Development server configuration
server: {
port: 1420,
strictPort: true,
// CRITICAL: Use 'localhost' not '0.0.0.0' for security
// This prevents external network access during development
host: 'localhost',
// Configure WebSocket for hot module replacement
hmr: {
protocol: 'ws',
host: 'localhost',
port: 1421
},
// Add CORS headers for Tauri
cors: true,
// Headers for better compatibility
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin'
}
},
// Environment variable prefixes
envPrefix: ['VITE_', 'TAURI_'],
// Build configuration
build: {
// Tauri supports ES2022
target: ['es2022', 'chrome100', 'safari13'],
// Enable source maps for debugging
sourcemap: true,
// Output directory
outDir: 'dist',
// Asset handling
assetsDir: 'assets',
// Rollup options for better compatibility
rollupOptions: {
input: {
main: path.resolve(__dirname, 'index.html'),
},
output: {
manualChunks: {
'react-vendor': ['react', 'react-dom'],
'ui-vendor': ['lucide-react', 'zustand']
}
}
}
},
// Resolve aliases for cleaner imports
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@commands': path.resolve(__dirname, './src-tauri/src/commands'),
'@analysis': path.resolve(__dirname, './src-tauri/src/analysis'),
'@core': path.resolve(__dirname, './src-tauri/src/core'),
'@scanning': path.resolve(__dirname, './src-tauri/src/scanning'),
'@utils': path.resolve(__dirname, './src-tauri/src/utils')
}
},
// Optimize dependencies
optimizeDeps: {
include: ['react', 'react-dom', 'zustand', '@tauri-apps/api']
}
})