-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.ts
52 lines (50 loc) · 1.33 KB
/
vite.config.ts
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
import react from '@vitejs/plugin-react';
import { defineConfig, loadEnv, type PluginOption } from 'vite';
import svgr from 'vite-plugin-svgr';
import tsconfigPaths from 'vite-tsconfig-paths';
import { visualizer } from 'rollup-plugin-visualizer';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
return {
plugins: [
react(),
svgr(),
tsconfigPaths(),
visualizer({
filename: './dist/report.html',
open: true,
brotliSize: true,
}) as PluginOption,
],
server: {
port: 5173,
proxy: {
'/api': {
target: env.VITE_APP_API_BASE_URL,
secure: false,
changeOrigin: true,
},
},
},
build: {
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('react') || id.includes('react-dom') || id.includes('react-router-dom')) {
return 'vendor';
}
// lottie-web은 lottie 청크로 분리
if (id.includes('lottie-web')) {
return 'lottie';
}
// react-calendar는 calendar 청크로 분리
if (id.includes('react-calendar')) {
return 'calendar';
}
},
},
},
},
};
});