Skip to content

Commit

Permalink
docs: add environment dependencies (#3085)
Browse files Browse the repository at this point in the history
Co-authored-by: neverland <[email protected]>
  • Loading branch information
9aoy and chenjiahan authored Jul 31, 2024
1 parent f9b3a86 commit 9c509ff
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions website/docs/en/guide/advanced/environments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,24 @@ export async function startDevServer() {
```

For detailed usage, please refer to: [SSR + Express Example](https://github.com/rspack-contrib/rspack-examples/tree/main/rsbuild/ssr-express).

## Add environment dependencies

By default, Rsbuild builds all environments in parallel. If an environment in your project depends on other environments to be compiled first, you can add the name of the environment you need to depend on to Rspack's [dependencies](https://rspack.dev/config/other-options#dependencies) configuration.

For example, the node environment depends on the web environment to be compiled first. You can add the following configuration:

```ts title=rsbuild.config.ts
export default {
environments: {
web: {},
node: {
tools: {
rspack: {
dependencies: ['web'],
},
},
},
},
};
```
21 changes: 21 additions & 0 deletions website/docs/zh/guide/advanced/environments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,24 @@ export async function startDevServer() {
```

详细使用情况可参考:[SSR + Express 示例](https://github.com/rspack-contrib/rspack-examples/tree/main/rsbuild/ssr-express)

## 添加 environment 依赖

默认情况下,Rsbuild 会并行构建所有环境。如果你的项目中某一个环境依赖其他环境预先编译完成,可以将你需要依赖的环境名称添加到 Rspack 的 [dependencies](https://rspack.dev/zh/config/other-options#dependencies) 配置中。

例如,node 环境依赖 web 环境预先编译完成,可以添加如下配置:

```ts title=rsbuild.config.ts
export default {
environments: {
web: {},
node: {
tools: {
rspack: {
dependencies: ['web'],
},
},
},
},
};
```

0 comments on commit 9c509ff

Please sign in to comment.