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

# environments

> `optional` **environments?**: `Record`\<`string`, `EnvironmentConfig`>

:::info Lynx 默认值覆盖
此项是 Rsbuild 配置，`pluginLynx` 覆盖了它的默认值。下方默认值指应用插件后的值。请在 `rsbuild.config.ts` 顶层配置，显式设置的值优先。

[完整行为见 Rsbuild 配置参考](https://rsbuild.rs/zh/config/environments)。
:::

[Config.environments](/next/zh/api/packages/rspeedy/interfaces/Config.md#environments) 选项用于设置输出的 environment。

## Default Value

未设置该选项时，Rspeedy 会向 Rsbuild 传入 `{ lynx: {} }`。

## Remarks

如果你没有使用 Lynx for Web，通常不需要此选项。

## Examples

- 为 Lynx 和 Web 使用不同的入口。

```ts
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  environments: {
    lynx: {},
    web: {
      source: { entry: { web: './src/index.web.jsx' } },
    },
  },
  source: {
    entry: './src/index.jsx',
  },
})
```

- 仅构建 Web 产物。

```ts
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  environments: {
    web: {
      source: { entry: { web: './src/index.web.jsx' } },
    },
  },
})
```
