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

# output.filename.bundle

> `optional` **bundle?**: [`BundleFilename`](/next/api/packages/rsbuild-plugin/type-aliases/BundleFilename.md)

:::info Lynx-specific option
This option is added by `pluginLynx`, rather than Rsbuild. In `rsbuild.config.ts`, pass it to `pluginLynx({ ... })`.
:::

The name of the bundle files.

## Default Value

`'[name].[platform].bundle'`

## Remarks

The following placeholders are supported:

- `[name]`: the name of the entry.
- `[platform]`: the name of the Rsbuild environment.
- `[contenthash]`: the hash of the bundle content.

## Examples

- Using content hash with length in bundle filename:

```js
import { defineConfig } from '@rsbuild/core'
import { pluginLynx } from '@lynx-js/rsbuild-plugin'

export default defineConfig({
  plugins: [
    pluginLynx({
      output: {
        filename: {
          bundle: '[name].[contenthash:8].bundle',
        },
      },
    }),
  ],
})
```

- Using a function to control the main bundle and the lazy bundles
  separately (e.g. emit lazy bundles into another directory with a git
  commit hash appended):

```js
import { execSync } from 'node:child_process'

import { defineConfig } from '@rsbuild/core'
import { pluginLynx } from '@lynx-js/rsbuild-plugin'

const gitHash = execSync('git rev-parse --short HEAD').toString().trim()

export default defineConfig({
  plugins: [
    pluginLynx({
      output: {
        filename: {
          bundle: ({ lazyBundle, platform }) =>
            lazyBundle
              ? `my-lazy-bundles/[name].[fullhash]-${gitHash}.bundle`
              : `[name].${platform}.bundle`,
        },
      },
    }),
  ],
})
```
