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

# performance.removeConsole

- **类型：** `boolean | ConsoleType[]`
- **默认值：** `false`

在生产模式构建时，是否自动移除代码中的 `console.[methodName]`。

## 全部移除

当 `removeConsole` 被设置为 `true` 时，会移除所有类型的 `console.[methodName]`：

```ts title="rsbuild.config.ts"
export default {
  performance: {
    removeConsole: true,
  },
};
```

## 指定类型

你也可以指定仅移除特定类型的 `console.[methodName]`，比如移除 `console.log` 和 `console.warn`：

```ts title="rsbuild.config.ts"
export default {
  performance: {
    removeConsole: ['log', 'warn'],
  },
};
```

目前支持配置以下类型的 console：

```ts
type ConsoleType = 'log' | 'info' | 'warn' | 'error' | 'table' | 'group';
```
