-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathvite.config.ts
More file actions
122 lines (121 loc) · 2.58 KB
/
vite.config.ts
File metadata and controls
122 lines (121 loc) · 2.58 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
122
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import prism from "vite-plugin-prismjs";
// https://vite.dev/config/
export default defineConfig(async () => ({
plugins: [
react({
babel: {
plugins: ["babel-plugin-react-compiler"],
},
}),
prism({
languages: [
"markup",
"html",
"xml",
"svg",
"rss",
"css",
"javascript",
"arduino",
"armasm",
"aspnet",
"bash",
"batch",
"c",
"cs",
"cpp",
"cmake",
"csv",
"d",
"diff",
"docker",
"elixir",
"erlang",
"fortran",
"git",
"go",
"gradle",
"graphql",
"haskell",
"http",
"java",
"json",
"json5",
"latex",
"log",
"matlab",
"mongodb",
"nginx",
"php",
"powershell",
"pug",
"python",
"r",
"jsx",
"tsx",
"renpy",
"ruby",
"rust",
"sass",
"scss",
"sql",
"swift",
"toml",
"typescript",
"vim",
"visual-basic",
"wasm",
"yaml",
"zig",
],
plugins: ["line-numbers"],
theme: "okaidia",
css: true,
}),
],
clearScreen: false,
server: {
port: 1420,
strictPort: true,
watch: {
ignored: ["server/**", "target/**"],
},
fs: {
// Prevent Vite from serving files from the target directory
strict: true,
allow: ["."],
exclude: ["target"],
},
proxy: {
// Proxy API and auth routes to the Rust server (default port 8080).
// This lets you run the real server while using Vite's HMR for client
// changes. Adjust PORT env var if your backend runs on a different port.
"/api": {
target: `http://127.0.0.1:${process.env.PORT ?? "8080"}`,
changeOrigin: true,
secure: false,
rewrite: (path: string) => path.replace(/^\/api/, "/api"),
},
// WebSocket endpoints used by the server (Vite will proxy WS when ws: true)
"/ws": {
target: `ws://127.0.0.1:${process.env.PORT ?? "8080"}`,
ws: true,
},
},
hmr: {
host: "127.0.0.1",
// Keep the HMR port equal to Vite's port so connections are stable
port: 1420,
},
},
optimizeDeps: {
// Exclude problematic modules that use top-level await
exclude: ["bson"],
},
build: {
outDir: "client/dist",
emptyOutDir: true,
},
}));