> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# 从 Rspeedy 升级

Rspeedy 会长期维护。你仍然可以访问[旧版 Rspeedy 官网](https://lynxjs.org/zh/rspeedy/index.html)。

Rspeedy（[`@lynx-js/rspeedy`](/next/zh/api/packages/rspeedy.md)）是 Lynx 之前使用的构建工具，基于 Rsbuild，提供 `rspeedy` 命令行，并使用 `lynx.config.ts` 作为配置文件。现在推荐直接使用 **Rsbuild + `pluginLynx`**，沿用 Rsbuild 的配置和插件生态。


Rspeedy 和 `pluginLynx` 使用同一套构建引擎。迁移主要涉及依赖、命令行和配置，应用代码无需重写。

### 更换依赖

移除 `@lynx-js/rspeedy`，安装 [`@rsbuild/core`](https://www.npmjs.com/package/@rsbuild/core)。

### 更换命令行

将 `rspeedy dev`、`rspeedy build`、`rspeedy preview` 和 `rspeedy inspect` 分别改成 `rsbuild dev`、`rsbuild build`、`rsbuild preview` 和 `rsbuild inspect`。

### 更换配置文件

把 `lynx.config.ts` 改名为 `rsbuild.config.ts`，将 `defineConfig` 的导入来源从 `@lynx-js/rspeedy` 改为 `@rsbuild/core`。

### 更新构建期类型

将 `tsconfig.json` 中 `types` 数组里的 `@lynx-js/rspeedy/client` 替换为 `@rsbuild/core/types`，保留其他项。

### 调整配置简写

将 [`source.entry`](https://rsbuild.rs/zh/config/source/entry) 和 [`output.filename`](https://rsbuild.rs/zh/config/output/filename) 的字符串简写改为对象形式。

### 迁移 Lynx 特有配置

将 [`output.filename.bundle`](/next/zh/api/build/output/filename/bundle.md)、[`performance.profile`](/next/zh/api/build/performance/profile.md) 等 Lynx 特有选项移入 `pluginLynx({ ... })`。需要这些配置时，在 `plugins` 中显式添加 `pluginLynx`；自动应用时使用的是默认选项。

## Rspeedy 与 Rsbuild 差异

两种方式都通过 `pluginLynx` 构建 Lynx Bundle；主要区别在于命令行和配置接口：

|           | Rspeedy                                               | Rsbuild + `pluginLynx`                                |
| --------- | ----------------------------------------------------- | ----------------------------------------------------- |
| 命令行       | `rspeedy dev / build / preview / inspect`             | `rsbuild dev / build / preview / inspect`             |
| 配置文件      | `lynx.config.ts`，`defineConfig` 来自 `@lynx-js/rspeedy` | `rsbuild.config.ts`，`defineConfig` 来自 `@rsbuild/core` |
| 配置范围      | Rsbuild 配置的子集，带严格校验；部分选项受限                            | 直接使用完整的 Rsbuild 配置和插件生态                               |
| Lynx 特有配置 | 直接写在配置文件中，如 `output.filename.bundle`                  | 传给 `pluginLynx({ ... })`                              |
| 配置简写      | `source.entry`、`output.filename` 支持字符串                | 使用对象形式                                                |
| 构建期类型     | `@lynx-js/rspeedy/client`                             | `@rsbuild/core/types`                                 |

例如，Rspeedy 不透传 `tools.postcss` 等配置，并固定了 `output.charset`、`output.polyfill` 等选项。使用 Rsbuild 后，可以直接按 [Rsbuild 配置参考](https://rsbuild.rs/zh/config/) 配置构建；Lynx 新增的选项和调整过的默认值见 [Lynx 构建配置参考](/next/zh/api/build.md)。



继续使用 Rspeedy 的项目，可以查阅 [Rspeedy 命令行文档](https://lynx-stack.dev/zh/guide/cli)和[版本升级指南](https://lynx-stack.dev/zh/guide/upgrade-rspeedy)。
