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

# supports

- **类型：** [Supports Types](#supportstypes)
- **可选：** `true`
- **默认值：** `undefined`

该选项用于控制详细的分析行为，例如 BannerPlugin 兼容、Bundle 解析和 gzip 大小计算。

## supportsTypes

```ts
type ISupport = {
  banner?: boolean;
  parseBundle?: boolean;
  brotli?: boolean | { brotliLevel?: number };
  gzip?:
    | boolean
    | {
        gzipLevel?: number;
      };
};
```

## banner

:::danger
`supports.banner` 分析仅用于调试，请勿将其用于生产。
:::

- **类型：** `boolean`
- **默认值：** `true`

如果开启 `supports.banner` 则会开启 Rsdoctor 对 BannerPlugin 的兼容逻辑。详细请看：[支持 BannerPlugin](/zh/guide/usage/bundle-size.md#-%E6%94%AF%E6%8C%81-bannerplugin)

## parseBundle

- **类型：** `boolean`
- **默认值：** `true`

在部分大型仓库中，反解 Bundle 解析执行耗时过大，这是因为 Parse Bundle 的分析利用了 AST 解析与处理。当产物文件过多时，耗时也会增加。如果不需要此功能，可以通过 `supports.parseBundle` 配置进行选择性关闭。示例如下：

```ts
chain.plugin('Rsdoctor').use(RsdoctorRspackPlugin, [
  {
    supports: {
      parseBundle: false,
    },
  },
]);
```

关闭 Parse Bundle 能力只会影响是否能查看到 Bundle 中 Module 的最终打包大小（Bundled Size）及最终打包代码（Bundled Code）:


![](https://assets.rspack.rs/others/assets/rsdoctor/bundled-size.jpeg)![](https://assets.rspack.rs/others/assets/rsdoctor/bundled-code.png)

## gzip

- **类型：** `boolean | { gzipLevel?: number }`
- **默认值：** `true`

控制 Rsdoctor 是否计算 Asset 和 Module 的 gzip 大小。该计算只影响 Rsdoctor 报告中的大小数据，不会修改或压缩构建产物。

当编译器以 watch 模式运行时，Rsdoctor 会跳过 gzip 大小计算。如需分析生产 Bundle 的 gzip 大小，请运行一次性构建。

gzip 大小计算默认开启，默认压缩级别为 `6`。将 `gzip` 配置为对象可以自定义 `gzipLevel`，其值必须是 `0` 到 `9` 之间的整数：

```ts
new RsdoctorRspackPlugin({
  supports: {
    gzip: {
      gzipLevel: 9,
    },
  },
});
```

将 `gzip` 设置为 `false` 可以关闭 gzip 大小计算：

```ts
new RsdoctorRspackPlugin({
  supports: {
    gzip: false,
  },
});
```

## brotli

- **类型：** `boolean | { brotliLevel?: number }`
- **默认值：** `false`

计算报告中 Asset 和 Module 的 Brotli 大小，并在体积卡片和矩形树图中展示。该选项不会压缩或修改构建产物。与 gzip 一样，watch 模式下会跳过 Brotli 计算。

设置 `brotli: true` 或 `brotli: {}` 时使用默认压缩级别 `6`。`brotliLevel` 必须是 `0` 到 `11` 之间的整数；较高的级别可能增加分析耗时。只需要 Brotli 大小时，可以独立关闭 gzip：

```ts
new RsdoctorRspackPlugin({
  supports: {
    gzip: false,
    brotli: { brotliLevel: 11 },
  },
});
```
