Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
73 lines (71 loc) · 1.86 KB
/
Copy pathvite.config.ts
File metadata and controls
73 lines (71 loc) · 1.86 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
const host = process.env.TAURI_DEV_HOST;
export default defineConfig(async () => {
const pkg = await import("./package.json", { with: { type: "json" } });
return {
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
define: {
__IS_TAURI__: JSON.stringify(!!process.env.TAURI_ENV_PLATFORM),
__APP_VERSION__: JSON.stringify(pkg.default.version),
},
build: {
target: "es2022",
rollupOptions: {
output: {
manualChunks(id) {
if (!id.includes("node_modules")) {
return;
}
if (
id.includes("react-markdown") ||
id.includes("react-syntax-highlighter") ||
id.includes("remark-gfm") ||
id.includes("rehype")
) {
return "markdown-vendor";
}
if (id.includes("recharts") || id.includes("d3-")) {
return "charts-vendor";
}
if (id.includes("lucide-react")) {
return "icons-vendor";
}
if (id.includes("react-router") || id.includes("@tanstack/")) {
return "routing-vendor";
}
if (
id.includes("react") ||
id.includes("scheduler") ||
id.includes("zustand")
) {
return "react-vendor";
}
},
},
},
},
clearScreen: false,
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
watch: {
ignored: ["**/src-tauri/**"],
},
},
};
});