其他静态平台
所有平台共享两个参数:
text
Build command: npm run docs:build
Output: docs/.vitepress/distGitHub Pages
使用官方 Pages Actions,把 docs/.vitepress/dist 作为 artifact 上传。项目站点通常位于仓库子路径,需要构建时设置:
yaml
env:
DOCS_BASE: /AniBakaWeb/如果绑定自定义域名并从根路径提供站点,则使用 /。
Vercel
json
{
"buildCommand": "npm run docs:build",
"outputDirectory": "docs/.vitepress/dist",
"framework": null
}无需 Serverless Function。
Netlify
toml
[build]
command = "npm run docs:build"
publish = "docs/.vitepress/dist"任意对象存储 / CDN
上传 docs/.vitepress/dist 的全部内容,并确保:
- HTML 以
text/html; charset=utf-8返回。 - 未命中路由返回
404.html与 404 状态。 /assets/下带哈希资源可长期缓存。- 不要把所有未知路由重写到
index.html。
Nginx
VitePress 开启了 clean URLs。静态服务器应按顺序尝试 $uri、$uri.html、$uri/,最终返回 /404.html。
