---
title: "部署到 Vercel"
description: "将 Astro 静态构建导入 Vercel，并检查部署结果。"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.microcharon.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 部署到 Vercel

## 部署前验证 {#build}

先运行 `pnpm install --frozen-lockfile`，再生成并预览构建。

```sh
pnpm build
pnpm preview
```

构建结果在 `dist/` 中，包含 HTML、Markdown 和 Pagefind 索引。

## 导入仓库 {#import}

在 Vercel 中导入此项目的 Git 仓库。框架预设选 **Astro**，构建命令使用 `pnpm build`，输出目录为 `dist`。构建环境选择 Node.js 24。

绑定正式域名后，可以用 `SITE_URL` 环境变量设置规范地址。没有设置该变量时，站点会读取 Vercel 提供的生产域名变量。详见 [配置参考](https://docs.microcharon.dev/reference/#site-url)。

## 检查部署结果 {#check}

1. 打开首页，检查文档分组和右侧目录。
2. 按 `Ctrl+K`（macOS 为 `⌘K`）搜索“Vercel”，打开对应的文档结果。
3. 打开 [Markdown 版本](https://docs.microcharon.dev/guides/deploy/index.md)和 [文档索引](https://docs.microcharon.dev/llms.txt)。
4. 在手机尺寸下展开菜单，确认可以从首页进入其他章节。

如果搜索没有结果，查看[故障排查](https://docs.microcharon.dev/reference/troubleshooting/#search)。

Source: https://docs.microcharon.dev/guides/deploy/index.mdx
