Skip to content

Commit f1ee9a7

Browse files
authored
Add debug logs for VitePress build info
Added debugging logs to display build environment variables and final base path.
1 parent 3696d34 commit f1ee9a7

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

www/.vitepress/config.mts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import { defineConfig } from "vitepress";
22

33
// --- 环境变量检测逻辑 ---
44
const isVercel = process.env.VERCEL === "1";
5-
// 新增:检测是否为 Cloudflare Pages 构建
65
const isCFPages = process.env.CF_PAGES === "1";
76

8-
// 只要是 Vercel 或 Cloudflare,都部署在根目录
97
const isRootDeploy = isVercel || isCFPages;
108

119
const repoUrl = "https://github.com/1024XEngineer/neo-code";
@@ -14,15 +12,21 @@ const docsBase = `${repoUrl}/blob/main/docs`;
1412
// 核心修改 1:动态基础路径
1513
const 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
1823
let siteUrl = "https://1024xengineer.github.io/neo-code/";
1924
if (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 下都能访问
2630
const brandImageUrl = `${siteUrl}brand/neocode-mark.png`;
2731

2832
export default defineConfig({

0 commit comments

Comments
 (0)