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, and this page is available as Markdown at /next/zh/guide/build/rspeedy.md.
Lynx
  • 简体中文
  • 从 Rspeedy 升级

    Rspeedy 会长期维护。你仍然可以访问旧版 Rspeedy 官网。

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

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

    更换依赖

    移除 @lynx-js/rspeedy,安装 @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 和 output.filename 的字符串简写改为对象形式。

    迁移 Lynx 特有配置

    将 output.filename.bundle、performance.profile 等 Lynx 特有选项移入 pluginLynx({ ... })。需要这些配置时,在 plugins 中显式添加 pluginLynx;自动应用时使用的是默认选项。

    Rspeedy 与 Rsbuild 差异

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

    RspeedyRsbuild + pluginLynx
    命令行rspeedy dev / build / preview / inspectrsbuild dev / build / preview / inspect
    配置文件lynx.config.ts,defineConfig 来自 @lynx-js/rspeedyrsbuild.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 配置参考 配置构建;Lynx 新增的选项和调整过的默认值见 Lynx 构建配置参考。

    继续使用 Rspeedy 的项目,可以查阅 Rspeedy 命令行文档和版本升级指南。

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。