-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
48 lines (45 loc) · 1.44 KB
/
vite.config.ts
File metadata and controls
48 lines (45 loc) · 1.44 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
import { defineConfig } from 'vite'
import { fileURLToPath, URL } from 'node:url'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig(({ command }) => {
const isDev = command === 'serve'
// If env overrides are provided (e.g. in HTTPS proxy environments), use them.
// Otherwise let Vite auto-detect HMR endpoint so it follows the actual dev port.
const envHmr = process.env.VITE_HMR_HOST
? {
protocol: process.env.VITE_HMR_PROTOCOL || 'wss',
host: process.env.VITE_HMR_HOST,
clientPort: Number(process.env.VITE_HMR_CLIENT_PORT) || 443,
}
: true
return {
plugins: [react()],
resolve: {
alias: {
'@components': fileURLToPath(new URL('./src/components', import.meta.url)),
'@features': fileURLToPath(new URL('./src/features', import.meta.url)),
'@pages': fileURLToPath(new URL('./src/pages', import.meta.url)),
'@lib': fileURLToPath(new URL('./src/lib', import.meta.url)),
'@store': fileURLToPath(new URL('./src/store', import.meta.url)),
},
},
optimizeDeps: {
exclude: ['zod'],
},
server: {
host: '0.0.0.0',
port: 5000,
strictPort: false, // allow Vite to pick a new port on conflict
allowedHosts: true,
hmr: isDev ? envHmr : undefined,
watch: {
usePolling: true,
},
},
preview: {
host: '0.0.0.0',
port: 5000,
},
}
})