Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 10 additions & 25 deletions website/docs/en/config/environments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,23 @@ Rsbuild supports building outputs for multiple environments. You can use `enviro
- **Type:**

```ts
interface EnvironmentConfig {
plugins?: RsbuildPlugins;
dev?: Pick<
DevConfig,
| 'hmr'
| 'client'
| 'liveReload'
| 'assetPrefix'
| 'progressBar'
| 'lazyCompilation'
| 'writeToDisk'
>;
html?: HtmlConfig;
tools?: ToolsConfig;
source?: SourceConfig;
output?: OutputConfig;
resolve?: ResolveConfig;
security?: SecurityConfig;
performance?: PerformanceConfig;
moduleFederation?: ModuleFederationConfig;
}

type Environments = {
[name: string]: EnvironmentConfig;
};
```

- **Default:** `undefined`

:::tip
`environments` does not support configuring `server` options and some `dev` options, because multiple environments share the same server instance.
:::
## Available options

`EnvironmentConfig` is a subset of the Rsbuild configuration, supporting most options.

Since multiple environments share the same server instance, the following options are currently not supported in `EnvironmentConfig`:

- `server.*`
- `dev.watchFiles`
- `dev.cliShortcuts`
- `dev.setupMiddlewares`

## Example

Expand Down
35 changes: 10 additions & 25 deletions website/docs/zh/config/environments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,23 @@ Rsbuild 支持同时为多个环境构建产物。你可以使用 `environments`
- **类型:**

```ts
interface EnvironmentConfig {
plugins?: RsbuildPlugins;
dev?: Pick<
DevConfig,
| 'hmr'
| 'client'
| 'liveReload'
| 'assetPrefix'
| 'progressBar'
| 'lazyCompilation'
| 'writeToDisk'
>;
html?: HtmlConfig;
tools?: ToolsConfig;
source?: SourceConfig;
output?: OutputConfig;
resolve?: ResolveConfig;
security?: SecurityConfig;
performance?: PerformanceConfig;
moduleFederation?: ModuleFederationConfig;
}

type Environments = {
[name: string]: EnvironmentConfig;
};
```

- **默认值:** `undefined`

:::tip
`environments` 中不支持配置 `server` 选项以及一部分 `dev` 选项,因为多个 environment 共享同一个 server 实例。
:::
## 可用选项

`EnvironmentConfig` 是 Rsbuild 配置的一个子集,支持大部分配置项。

由于多个 environment 共享同一个 server 实例,以下选项暂不支持在 `EnvironmentConfig` 中配置:

- `server.*`
- `dev.watchFiles`
- `dev.cliShortcuts`
- `dev.setupMiddlewares`

## 示例

Expand Down
Loading