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

# tools.styleLoader

- **Type:** `Object | Function`
- **Default:** `{}`

The config of [style-loader](https://github.com/webpack/style-loader) can be set through `tools.styleLoader`.

It is worth noting that Rsbuild does not enable `style-loader` by default. You can use [output.injectStyles](/config/output/inject-styles.md) config to enable it.

## Object type

When `tools.styleLoader` is an object, it will be merged with the default configuration using `Object.assign`.

```ts title="rsbuild.config.ts"
export default {
  tools: {
    styleLoader: {
      insert: 'head',
    },
  },
};
```

## Function type

When `tools.styleLoader` is a function, the default options will be passed in as the first parameter. You can directly modify this object or return a new object as the final options to be used. For example:

```ts title="rsbuild.config.ts"
export default {
  tools: {
    styleLoader: (config) => {
      config.insert = 'head';
      return config;
    },
  },
};
```
