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

# tools.cssLoader

- **Type:** `Object | Function`
- **Default:** Generated from [output.cssModules](/config/output/css-modules.md) and [output.sourceMap](/config/output/source-map.md).

Rsbuild uses [css-loader](https://github.com/webpack/css-loader) by default to handle CSS resources. You can modify the options of css-loader through `tools.cssLoader`.

:::tip
To modify the options related to CSS Modules, it is recommended to use the [output.cssModules](/config/output/css-modules.md) config first.
:::

### Object type

When this value is an Object, it is merged with the default config via deep merge. For example:

```ts title="rsbuild.config.ts"
export default {
  tools: {
    cssLoader: {
      modules: {
        exportOnlyLocals: true,
      },
    },
  },
};
```

### Function type

When the value is a Function, the default config is passed in as the first parameter. You can modify the config object directly, or return an object as the final config. For example:

```ts title="rsbuild.config.ts"
export default {
  tools: {
    cssLoader: (config) => {
      config.modules.exportOnlyLocals = true;
      return config;
    },
  },
};
```
