forked from bakeronchain/learnvault
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
88 lines (87 loc) · 1.87 KB
/
vite.config.ts
File metadata and controls
88 lines (87 loc) · 1.87 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
import tailwindcss from "@tailwindcss/vite"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
import { nodePolyfills } from "vite-plugin-node-polyfills"
import wasm from "vite-plugin-wasm"
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss(),
nodePolyfills({
include: ["buffer"],
globals: {
Buffer: true,
},
}),
wasm(),
],
optimizeDeps: {
esbuildOptions: {
loader: {
".js": "jsx",
},
},
exclude: ["@stellar/stellar-xdr-json"],
},
build: {
target: "esnext",
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("node_modules")) {
if (
id.includes("/react/") ||
id.includes("\\react\\") ||
id.includes("react-dom") ||
id.includes("scheduler") ||
id.includes("@tanstack/react-query") ||
id.includes("@stellar/design-system")
) {
return "framework"
}
if (id.includes("@theahaco/contract-explorer")) {
return "contract-explorer"
}
if (id.includes("recharts")) {
return "charts"
}
if (
id.includes("@stellar/stellar-sdk") ||
id.includes("@stellar/stellar-xdr-json") ||
id.includes("@creit.tech/stellar-wallets-kit")
) {
return "stellar"
}
if (id.includes("react-router")) {
return "router"
}
if (id.includes("i18next")) {
return "i18n"
}
}
if (/[\\/]src[\\/]contracts[\\/]/.test(id)) {
return "contract-clients"
}
},
},
},
},
define: {
global: "window",
},
envPrefix: ["PUBLIC_", "VITE_"],
server: {
proxy: {
"/friendbot": {
target: "http://localhost:8000/friendbot",
changeOrigin: true,
},
"/api": {
target: "http://localhost:8000",
changeOrigin: true,
// Don't rewrite /api prefix — backend expects it
},
},
},
})