-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
40 lines (38 loc) · 1.03 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
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return defineConfig({
server: {
open: true, //개발 서버를 실행할 때 브라우저를 자동으로 엽니다.
proxy: {
"/api": {
target: `${env.VITE_API_URL}`, // 실제 백엔드 서버 URL로 변경
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
headers: {
Origin: `${env.VITE_API_URL}`,
},
host: "127.0.0.1",
port: 5173,
},
preview: {
host: "127.0.0.1",
port: 5173,
},
plugins: [react(), tsconfigPaths()],
resolve: {
alias: [
{ find: "@components", replacement: "/src/components" },
{ find: "@assets", replacement: "/src/assets" },
{ find: "@", replacement: "/src" },
],
},
define: {
"process.env": {},
},
});
};