构建配置
Cloudflare Pages
| 配置项 | 推荐值 |
|---|---|
| Project name | hideapps-docs |
| Production branch | main |
| Framework preset | VitePress |
| Build command | npx vitepress build |
| Build output directory | .vitepress/dist |
| Production domain | docs.hideapps.top |
package.json
json
{
"scripts": {
"dev": "vitepress dev --host 127.0.0.1",
"build": "vitepress build",
"preview": "vitepress preview --host 127.0.0.1",
"deploy": "npm run build && wrangler pages deploy .vitepress/dist --project-name hideapps-docs"
}
}wrangler.toml
toml
name = "hideapps-docs"
pages_build_output_dir = ".vitepress/dist"
compatibility_date = "2026-06-24"pages_build_output_dir 让 Wrangler 知道 Pages 项目的静态输出目录。Git 集成部署时仍建议在 Cloudflare Dashboard 中确认构建命令和输出目录。
Node 版本
为了减少本地和 Cloudflare 构建环境差异,建议在 Cloudflare Pages 的环境变量中设置:
text
NODE_VERSION=22如果你的团队使用 .nvmrc 或 Volta,也可以把 Node 版本固定在仓库中。