We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f52451c commit 4c63371Copy full SHA for 4c63371
1 file changed
docs/.vitepress/config.ts
@@ -11,12 +11,14 @@ const whiteBookSidebar = generateWhiteBookSidebar()
11
/**
12
* Base URL 配置
13
* - 开发环境:使用 '/'
14
- * - GitHub Pages:使用 '/KeyApp/'(通过 CI 环境变量设置)
15
- * - 自定义部署:通过 VITEPRESS_BASE 环境变量设置
+ * - 生产构建:默认使用 '/KeyApp/'(避免 GitHub Pages 资源路径丢失仓库前缀)
+ * - 自定义部署:通过 VITEPRESS_BASE 环境变量覆盖
16
*
17
* 注意:VitePress 的 Vue Router 需要绝对路径 base,不能用 './'
18
*/
19
-const base = process.env.VITEPRESS_BASE ?? '/'
+const githubRepoFromEnv = process.env.GITHUB_REPOSITORY?.split('/')[1] ?? GITHUB_REPO
20
+const defaultBase = process.env.NODE_ENV === 'production' ? `/${githubRepoFromEnv}/` : '/'
21
+const base = process.env.VITEPRESS_BASE ?? defaultBase
22
23
export default defineConfig({
24
title: 'BFM Pay',
0 commit comments