-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
64 lines (57 loc) · 1.56 KB
/
vite.config.ts
File metadata and controls
64 lines (57 loc) · 1.56 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
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react-swc";
import { defineConfig, loadEnv } from "vite";
import svgr from "vite-plugin-svgr";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return {
plugins: [react(), svgr({ include: "**/*.svg?react" }), tailwindcss()],
// 개발 서버 및 프록시 설정
server: {
host: "0.0.0.0",
port: 5173,
proxy: {
"/api": {
target: env.VITE_API_TARGET_URL,
changeOrigin: true,
},
},
},
// 경로 별칭
resolve: {
alias: {
"@": "/src",
},
dedupe: ["react", "react-dom"],
},
// 사전 번들링 최적화
optimizeDeps: {
include: ["react-apexcharts", "apexcharts"],
},
// 배포 시 콘솔 로그 제거
esbuild: {
drop: mode === "production" ? ["console", "debugger"] : [],
},
// 빌드 최적화
build: {
chunkSizeWarningLimit: 1000, // 청크 크기 경고 한도 상향
rollupOptions: {
output: {
// 라이브러리 및 코드 분할
manualChunks(id) {
if (id.includes("node_modules")) {
if (
id.includes("react") ||
id.includes("react-dom") ||
id.includes("react-router-dom")
) {
return "react-vendor"; // 리액트 관련 코어
}
return "vendor"; // 기타 라이브러리
}
},
},
},
},
};
});