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

# dev.browserLogs

- **Type:**

```ts
type BrowserLogs =
  | boolean
  | {
      stackTrace?: 'summary' | 'full' | 'none';
    };
```

- **Default:** `{ stackTrace: 'summary' }`

Controls whether to forward browser runtime errors to the terminal.

When set to `true`, Rsbuild's client script listens for `window.error` events and unhandled Promise rejections in the browser, then sends these errors to the dev server. The server prints them in the terminal with a `[browser]` prefix, along with improved formatting and contextual information.

This feature is particularly useful when working with AI coding agents that can only read terminal output, helping them better understand runtime errors and assist in debugging.

## Example

For example, if you have the following code in your application:

```jsx title="src/App.jsx"
const App = () => {
  const item = undefined;
  return <div>{item.name}</div>;
};
```

The browser will throw an error, and Rsbuild will forward this error to the terminal:

```bash
error   [browser] Uncaught TypeError: Cannot read properties of undefined (reading 'name')
 at handleClick (src/App.jsx:3:0)
```

## Options

### stackTrace

- **Type:** `'summary' | 'full' | 'none'`
- **Default:** `'summary'`

Controls how the error stack trace is displayed in the terminal when forwarding browser errors.

- `'summary'` – Show only the first frame (e.g. `(src/App.jsx:3:0)`).
- `'full'` – Print the full stack trace with all frames.
- `'none'` – Hide stack traces.

For example, setting `stackTrace` to `'full'`:

```ts title="rsbuild.config.ts"
export default {
  dev: {
    browserLogs: {
      stackTrace: 'full',
    },
  },
};
```

The full stack trace will be like:

```bash
error   [browser] Uncaught TypeError: Cannot read properties of undefined (reading 'name')
    at handleClick (src/App.jsx:6:0)
    at someFunction (src/App.jsx:12:0)
    at App (src/App.jsx:6:0)
    ...
```

## Disabling

Set `dev.browserLogs` to `false` to disable this behavior.

```ts title="rsbuild.config.ts"
export default {
  dev: {
    browserLogs: false,
  },
};
```

## Version history

| Version | Changes                   |
| ------- | ------------------------- |
| v1.5.13 | Added this option         |
| v1.6.0  | Added `stackTrace` option |
