Files
sam-react/vite.config.ts

50 lines
1.6 KiB
TypeScript
Raw Normal View History

2025-10-13 17:37:10 +09:00
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
2025-10-13 17:37:10 +09:00
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss(),
],
2025-10-13 17:37:10 +09:00
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@/components': path.resolve(__dirname, './src/components'),
'@/pages': path.resolve(__dirname, './src/pages'),
'@/hooks': path.resolve(__dirname, './src/hooks'),
'@/services': path.resolve(__dirname, './src/services'),
'@/stores': path.resolve(__dirname, './src/stores'),
'@/utils': path.resolve(__dirname, './src/utils'),
'@/types': path.resolve(__dirname, './src/types'),
'@/lib': path.resolve(__dirname, './src/lib'),
},
},
server: {
host: '0.0.0.0', // Docker 컨테이너 내 모든 네트워크 인터페이스에서 접근 허용
port: 5173,
strictPort: true,
// Nginx 리버스 프록시를 통한 도메인 접근 허용
hmr: {
clientPort: 80, // HTTP 사용 (nginx가 port 80에서 리스닝)
protocol: 'ws', // HTTP 환경에서는 WebSocket (ws) 사용
host: 'dev.sam.kr', // HMR 연결 시 사용할 호스트
},
// 파일 감시 설정 (Docker 환경에서 필수)
watch: {
usePolling: true,
interval: 100, // 폴링 간격 (ms)
},
// CORS 설정 (필요한 경우)
cors: true,
// 리버스 프록시를 통한 도메인 접근 허용
allowedHosts: [
'dev.sam.kr',
'localhost',
'127.0.0.1',
'.sam.kr', // 서브도메인 와일드카드
],
},
})