File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,10 +2,8 @@ import { defineConfig } from "vitepress";
22
33// --- 环境变量检测逻辑 ---
44const isVercel = process . env . VERCEL === "1" ;
5- // 新增:检测是否为 Cloudflare Pages 构建
65const isCFPages = process . env . CF_PAGES === "1" ;
76
8- // 只要是 Vercel 或 Cloudflare,都部署在根目录
97const isRootDeploy = isVercel || isCFPages ;
108
119const repoUrl = "https://github.com/1024XEngineer/neo-code" ;
@@ -14,15 +12,21 @@ const docsBase = `${repoUrl}/blob/main/docs`;
1412// 核心修改 1:动态基础路径
1513const base = isRootDeploy ? "/" : "/neo-code/" ;
1614
15+ // 👇👇👇 新增这段调试日志 👇👇👇
16+ console . log ( "====== VitePress Build Info ======" ) ;
17+ console . log ( "VERCEL Env:" , process . env . VERCEL ) ;
18+ console . log ( "CF_PAGES Env:" , process . env . CF_PAGES ) ;
19+ console . log ( "Final Base Path:" , base ) ;
20+ console . log ( "==================================" ) ;
21+
1722// 核心修改 2:动态站点 URL
1823let siteUrl = "https://1024xengineer.github.io/neo-code/" ;
1924if ( isVercel ) {
2025 siteUrl = `https://${ process . env . VERCEL_URL || 'neocode-docs.vercel.app' } /` ;
2126} else if ( isCFPages ) {
22- siteUrl = "https://neocode-docs.pages.dev/" ; // 这里对应你在 CF 上创建的空壳项目名
27+ siteUrl = "https://neocode-docs.pages.dev/" ;
2328}
2429
25- // 核心修改 3:确保图片路径在不同 base 下都能访问
2630const brandImageUrl = `${ siteUrl } brand/neocode-mark.png` ;
2731
2832export default defineConfig ( {
You can’t perform that action at this time.
0 commit comments