-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathvite.config.ts
More file actions
59 lines (58 loc) · 2.18 KB
/
Copy pathvite.config.ts
File metadata and controls
59 lines (58 loc) · 2.18 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(import.meta.dirname, "./src"),
},
},
build: {
// Chunk size warning limit - raised to accommodate optimized chunks
chunkSizeWarningLimit: 1000,
rollupOptions: {
output: {
// Manual chunks for better code splitting - split large vendor deps
manualChunks(id) {
const normalizedId = id.replace(/\\/g, "/");
// Route the prism wrapper (src/lib/prism.ts) into the same chunk
// as prismjs from node_modules. The wrapper sets globalThis.Prism
// which is required by prism-sql's bare Prism reference in Rolldown.
if (normalizedId.includes("/src/lib/prism")) return "vendor-prism";
if (normalizedId.includes("node_modules")) {
if (
normalizedId.includes("/node_modules/react/") ||
normalizedId.includes("/node_modules/react-dom/") ||
normalizedId.includes("/node_modules/scheduler/")
)
return "vendor-react";
if (
normalizedId.includes("@reactflow") ||
normalizedId.includes("reactflow") ||
normalizedId.includes("dagre")
)
return "vendor-reactflow";
if (
normalizedId.includes("jspdf") ||
normalizedId.includes("html2canvas")
)
return "vendor-pdf";
if (normalizedId.includes("jszip")) return "vendor-zip";
if (normalizedId.includes("@radix-ui")) return "vendor-ui";
if (normalizedId.includes("lucide-react")) return "vendor-icons";
if (normalizedId.includes("prismjs")) return "vendor-prism";
if (normalizedId.includes("sql-formatter")) return "vendor-sql";
if (
normalizedId.includes("diff") ||
normalizedId.includes("drizzle-orm") ||
normalizedId.includes("jose")
)
return "vendor-utils";
}
},
},
},
},
});