-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
91 lines (89 loc) · 3.21 KB
/
vite.config.ts
File metadata and controls
91 lines (89 loc) · 3.21 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import svgr from 'vite-plugin-svgr';
import tailwindcss from '@tailwindcss/vite';
import { visualizer } from 'rollup-plugin-visualizer';
import { VitePWA } from 'vite-plugin-pwa';
import path from 'path';
// https://vite.dev/config/
export default defineConfig({
server: {
host: '0.0.0.0', // 외부 디바이스 접속 설정
proxy: {
'/api': {
target: 'https://dev-api-studytrip.duckdns.org', // 실제 백엔드 주소
changeOrigin: true,
},
},
},
resolve: {
alias: {
'@components': path.resolve(__dirname, 'src/components'),
'@pages': path.resolve(__dirname, 'src/pages'),
'@assets': path.resolve(__dirname, 'src/assets'),
'@utils': path.resolve(__dirname, 'src/utils'),
'@constants': path.resolve(__dirname, 'src/constants'),
'@hooks': path.resolve(__dirname, 'src/hooks'),
'@services': path.resolve(__dirname, 'src/services'),
'@store': path.resolve(__dirname, 'src/store'),
'@types': path.resolve(__dirname, 'src/types'),
'@lib': path.resolve(__dirname, 'src/lib'),
},
},
plugins: [
react(),
svgr(), // SVG 파일을 React 컴포넌트로 변환
tailwindcss(),
visualizer({
open: true, // 빌드 후 자동으로 브라우저 열기
filename: 'stats.html', // 출력 파일명
gzipSize: true, // gzip 압축 크기 표시
brotliSize: true, // brotli 압축 크기 표시
}),
VitePWA({
registerType: 'autoUpdate', // 서비스 워커 자동 업데이트
// localhost 에서 Service Worker + Manifest 등록
devOptions: {
enabled: true,
},
injectRegister: 'auto', // 서비스 워커 자동 등록
manifest: {
name: 'Study Trip',
short_name: 'StudyTrip',
start_url: '/',
display: 'standalone',
background_color: '#ffffff',
theme_color: '#000000',
// 192, 512 해상도에서 홈 화면 아이콘 지원
icons: [
{
src: '/assets/icons/icon-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/assets/icons/icon-512x512.png',
sizes: '512x512',
type: 'image/png',
},
],
},
}),
],
build: {
rollupOptions: {
output: {
manualChunks: {
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
'axios-vendor': ['axios'],
'ui-vendor': [
'@dnd-kit/core',
'@dnd-kit/sortable',
'swiper',
'react-datepicker',
],
},
},
},
},
});