For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/guide/start/cicd.md.
close
  • 简体中文
  • CI/CD 使用教程

    Brief 模式会生成一份自包含报告,适合作为 CI 产物保存或上传到 CDN。

    开启 Brief 模式

    配置 output.mode: 'brief',并在 output.options.type 中包含 HTML。构建完成后,Rsdoctor 会在报告输出目录中生成 rsdoctor-report.html;该目录默认为 [outputDir],也可通过 output.reportDir 修改。直接在浏览器中打开该文件即可查看报告。

    rspack.config.mjs
    import { RsdoctorRspackPlugin } from '@rsdoctor/core';
    
    export default {
      plugins: [
        // 仅在 RSDOCTOR 为 true 时注册插件,因为插件会增加构建耗时
        process.env.RSDOCTOR &&
          new RsdoctorRspackPlugin({
            output: {
              mode: 'brief',
              options: {
                type: ['html'],
              },
            },
          }),
      ].filter(Boolean),
    };

    报告模式

    Rsdoctor 2.x 支持 normal 和 brief 输出模式。旧版 lite 模式仅为向后兼容而保留。

    • normal 模式: 在构建产物目录中生成一个 .rsdoctor 文件夹,其中包含各种数据文件,并在报告页面中展示代码。输出目录可以通过 reportDir 进行配置。

    • brief 模式: 在报告输出目录中生成 rsdoctor-report.html。该目录默认为构建产物目录,也可通过 reportDir 配置。所有构建分析数据都会注入这个独立 HTML 文件,可以直接在浏览器中打开。可用配置项请参阅 mode: 'brief'

    • lite 模式: 基于普通模式,不展示源码和产物代码,仅显示打包后的代码信息。

      • 顶层 mode: 'lite' 配置已在 Rsdoctor 2.x 中移除且会被忽略。features lite 配置仍受支持。新配置请使用 output.reportCodeType