-
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathvite.config.ts
More file actions
44 lines (42 loc) · 1.25 KB
/
vite.config.ts
File metadata and controls
44 lines (42 loc) · 1.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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import themePlugin from "@replit/vite-plugin-shadcn-theme-json";
import path, { dirname } from "path";
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default defineConfig({
plugins: [react(), runtimeErrorOverlay(), themePlugin()],
resolve: {
alias: {
"@": path.resolve(__dirname, "client", "src"),
},
},
root: ".",
publicDir: "public",
build: {
outDir: "dist",
emptyOutDir: true,
},
server: {
port: 5173,
strictPort: true,
proxy: {
'/api/nvidia': {
target: 'https://integrate.api.nvidia.com/v1',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/nvidia/, ''),
configure: (proxy, _options) => {
proxy.on('proxyReq', (proxyReq, req, _res) => {
// Copy the authorization header from the original request
const authHeader = req.headers['authorization'];
if (authHeader) {
proxyReq.setHeader('Authorization', authHeader);
}
});
},
},
},
}
});