Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
121 lines (108 loc) · 3.26 KB
/
Copy pathvite.config.ts
File metadata and controls
121 lines (108 loc) · 3.26 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import { fileURLToPath, URL } from 'node:url';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
import { VitePWA } from 'vite-plugin-pwa';
import svgr from 'vite-plugin-svgr';
// https://vite.dev/config/
export default defineConfig({
plugins: [
// Google 로고는 luminance mask와 브랜드 색상을 그대로 유지한다.
svgr({
include: '**/icons/googleLogo.svg?react',
svgrOptions: {
icon: true,
},
}),
// Preserve the original colors of multicolor notification icons.
svgr({
include: '**/icons/notificationPageIcons/**/*.svg?react',
svgrOptions: {
icon: true,
},
}),
// 단색 아이콘 (line icon)
// 모든 색을 currentColor로 치환해서 className으로 색 조절 가능
svgr({
include: '**/icons/**/*.svg?react',
exclude: [
'**/icons/googleLogo.svg?react',
'**/icons/notificationPageIcons/**/*.svg?react',
],
svgrOptions: {
icon: true,
plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx'],
svgoConfig: {
plugins: [
{
name: 'convertColors',
params: { currentColor: true },
},
],
},
},
}),
// 다색 아이콘 / 로고 / 일러스트
// 원본 색 유지
svgr({
include: '**/illustrations/**/*.svg?react',
svgrOptions: {
icon: true,
},
}),
react(),
tailwindcss(),
VitePWA({
registerType: 'autoUpdate',
strategies: 'injectManifest',
srcDir: 'src',
filename: 'serviceWorker.ts',
includeAssets: ['favicon.ico', 'favicon.svg', 'apple-touch-icon.png'],
manifest: {
name: 'Boogle',
short_name: 'Boogle',
description: '기억이 아닌 기록으로 내 장 건강을 확인하세요',
lang: 'ko-KR',
theme_color: '#FF8253',
background_color: '#FF8253',
display: 'standalone',
orientation: 'portrait-primary',
start_url: '/',
scope: '/',
icons: [
{
src: '/pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
},
],
},
// strategies가 injectManifest이므로 generateSW 전용 workbox 옵션은
// 무시된다. injectManifest 키에 설정해야 실제로 적용된다.
injectManifest: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,json,woff,woff2}'],
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024,
},
}),
],
optimizeDeps: {
include: ['lottie-react'],
},
resolve: {
// lottie-react는 exports 필드가 없고 browser 필드가 UMD를 가리킴.
// browser보다 module(ESM)을 먼저 찾도록 우선순위 지정.
mainFields: ['module', 'jsnext:main', 'jsnext', 'browser', 'main'],
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
react: fileURLToPath(new URL('./node_modules/react', import.meta.url)),
'react-dom': fileURLToPath(
new URL('./node_modules/react-dom', import.meta.url),
),
},
},
});