-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
43 lines (41 loc) · 1.28 KB
/
Copy pathvite.config.ts
File metadata and controls
43 lines (41 loc) · 1.28 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
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
build: {
// 与 CSS 实际基线对齐:全站大量 color-mix()/oklch(需 Chrome 111 / Safari 16.2+),
// JS 没必要为更老的引擎转译。
target: ["es2022", "chrome111", "safari16.2", "firefox113"],
rollupOptions: {
output: {
manualChunks(id) {
const normalized = id.replace(/\\/g, "/");
if (!normalized.includes("/node_modules/")) return;
if (
/\/node_modules\/(?:react|react-dom|react-router|react-router-dom)\//.test(
normalized,
)
) {
return "react";
}
if (normalized.includes("/node_modules/@tanstack/react-query/")) {
return "query";
}
if (/\/node_modules\/(?:uplot|uplot-react)\//.test(normalized)) {
return "charts";
}
if (normalized.includes("/node_modules/zod/")) {
return "validation";
}
},
},
},
},
});