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

# Performance

`performance` configures Rspack's performance hint mechanism, helping you identify oversized outputs during the build.

It compares asset sizes and entrypoint total sizes against thresholds to decide whether hints should be emitted, and `hints` controls the hint level (`warning` / `error` / disabled).

You can define budget thresholds with `maxAssetSize` and `maxEntrypointSize`, and use `assetFilter` to exclude files that should not be counted, so hints better match your real performance goals.

## performance


- Type: `false | object`


By default, performance hints are enabled only in production mode for browser targets.

For example, when `performance` is omitted:

| `mode`                      | `target`                 | Default `performance`  |
| --------------------------- | ------------------------ | ---------------------- |
| `'production'`              | `'web'` or `'webworker'` | `{ hints: 'warning' }` |
| `'production'`              | `'node'`                 | `false`                |
| `'development'` or `'none'` | `'web'`                  | `false`                |

To enable performance hints for a Node.js production build, set `performance: {}`. To enable them in development or none mode, also set `performance.hints` to `'warning'` or `'error'`.

Set `performance` to `false` to disable the performance hints:

```js title="rspack.config.mjs"
export default {
  performance: false,
};
```

## performance.assetFilter


- Type: `(assetFilename: string) => boolean`


Used to filter which assets are included in performance hint calculations. Files returning `true` are included, and files returning `false` are ignored.

By default, Rspack excludes assets marked as development assets, such as source maps. A custom `assetFilter` replaces this default filter and applies to both individual asset sizes and entrypoint total sizes.

Ignore CSS files when calculating performance hints:

```js title="rspack.config.mjs"
export default {
  performance: {
    assetFilter: (assetFilename) => !assetFilename.endsWith('.css'),
  },
};
```

## performance.hints


- Type: `false | 'error' | 'warning'`
- Default:[production mode](/config/mode#production) is`warning`, [development mode](/config/mode#development) is`false`


In none mode, `hints` also defaults to `false`. These defaults apply when `performance` is an object. When `performance` is `false`, performance hints are disabled regardless of the mode.

Controls whether performance hints are enabled and which level to use:

- `false`: Disable performance hints
- `'warning'`: Emit hints as warnings
- `'error'`: Emit hints as errors, which fails the build

Treat performance hints as build errors:

```js title="rspack.config.mjs"
export default {
  performance: {
    hints: process.env.NODE_ENV === 'production' ? 'error' : false,
  },
};
```

## performance.maxAssetSize

- **Type:**: `number`
- **Default:**: `307200` (`300 KiB`)

Sets the size threshold for a single asset (in bytes). Rspack emits a performance hint when an asset exceeds this value.

Lower the single asset size limit to catch oversized files earlier:

```js title="rspack.config.mjs"
export default {
  performance: {
    maxAssetSize: 100000,
  },
};
```

## performance.maxEntrypointSize

- **Type:**: `number`
- **Default:**: `512000` (`500 KiB`)

Sets the total size threshold for an entrypoint (in bytes). Entrypoint total size means the total size needed for the initial load of that entry. Rspack emits a performance hint when the entrypoint total size exceeds this value.

For example, set the entrypoint size threshold to 500 KB:

```js title="rspack.config.mjs"
export default {
  performance: {
    maxEntrypointSize: 500000,
  },
};
```


This page is adapted from [webpack documentation](https://webpack.js.org/configuration/performance/) under the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), with modifications.

