-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
69 lines (66 loc) · 2.25 KB
/
vite.config.ts
File metadata and controls
69 lines (66 loc) · 2.25 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
import * as path from "path";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
import fs from "fs";
// vite에서 @/store/useAuthStore와 같은 절대 경로를 사용하려면,
// vite.config.ts 파일에서 alias 설정을 추가해야 합니다.
export default defineConfig(({ mode }: { mode: string }) => {
const isProduction = mode === "production";
const keyPath = "./certs/key.pem";
const certPath = "./certs/cert.pem";
return {
server: {
port: 5173,
host: true, // 외부에서 접속 가능하도록 설정
strictPort: true,
allowedHosts: ["mbtips.kr"],
hmr: isProduction
? false
: {
host: "localhost",
protocol: "wss"
},
https: isProduction
? undefined // 배포 환경에서는 HTTPS를 비활성화 (Nginx가 처리)
: fs.existsSync(keyPath) && fs.existsSync(certPath)
? { key: fs.readFileSync(keyPath), cert: fs.readFileSync(certPath) }
: undefined
},
plugins: [react(), tailwindcss()],
resolve: {
alias: [
{ find: "@/", replacement: path.resolve(__dirname, "src") },
{ find: "@/api", replacement: path.resolve(__dirname, "src/api") },
{
find: "@/components",
replacement: path.resolve(__dirname, "src/components")
},
{ find: "@/hooks", replacement: path.resolve(__dirname, "src/hooks") },
{
find: "@/pages",
replacement: path.resolve(__dirname, "src/pages")
},
{ find: "@/store", replacement: path.resolve(__dirname, "src/store") },
{ find: "@/types", replacement: path.resolve(__dirname, "src/types") },
{ find: "@/utils", replacement: path.resolve(__dirname, "src/utils") },
{
find: "@/constants",
replacement: path.resolve(__dirname, "src/constants")
},
{
find: "@/libs",
replacement: path.resolve(__dirname, "src/libs")
},
{
find: "@/mock",
replacement: path.resolve(__dirname, "src/mock")
},
{
find: "@/services",
replacement: path.resolve(__dirname, "src/services")
}
]
}
};
});