-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.ghpages.config.ts
More file actions
47 lines (46 loc) · 1.32 KB
/
vite.ghpages.config.ts
File metadata and controls
47 lines (46 loc) · 1.32 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
/**
* GitHub Pages 专用构建配置
*
* 使用方法:
* pnpm build:ghpages
*
* 构建产物在 dist-ghpages/ 目录,可直接推送到 gh-pages 分支
*
* 注意:
* - base 设置为 './' 以支持相对路径(适配任意 GitHub Pages 子路径)
* - 如果部署在 https://username.github.io/repo-name/ 则需要将 base 改为 '/repo-name/'
*/
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import path from "node:path";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": path.resolve(import.meta.dirname, "client", "src"),
"@shared": path.resolve(import.meta.dirname, "shared"),
},
},
root: path.resolve(import.meta.dirname, "client"),
base: "/llm-benchmark-costco/",
build: {
outDir: path.resolve(import.meta.dirname, 'dist-ghpages'),
emptyOutDir: true,
modulePreload: false,
rollupOptions: {
external: ['mermaid'],
output: {
// 代码分割:将大型依赖单独打包
manualChunks: {
'react-vendor': ['react', 'react-dom'],
'ui-vendor': ['lucide-react', 'framer-motion'],
'router': ['wouter'],
},
globals: {
mermaid: 'mermaid',
},
},
},
},
});