You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/api/javascript-api/environment-api.mdx
+74-8Lines changed: 74 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,14 @@
1
1
# Environment API
2
2
3
-
This section describes some type definitions related to Rsbuild environment API.
3
+
Here you can find all the environment related APIs.
4
+
5
+
> See [Multi-Environment Builds](/guide/advanced/environments) for more details.
4
6
5
7
## Environment Context
6
8
7
9
Environment context is a read-only object that provides some context information about the current environment.
8
10
9
-
In Rsbuild's hooks, you can get the environment context object through the `environment` or `environments` parameter.
11
+
In Rsbuild's [Plugin hooks](/plugins/dev/hooks#plugin-hooks), you can get the environment context object through the `environment` or `environments` parameter.
10
12
11
13
```ts
12
14
typeEnvironmentContext= {
@@ -25,16 +27,34 @@ type EnvironmentContext = {
25
27
The unique name of the current environment is used to distinguish and locate the environment, corresponds to the key in the [environments](/config/environments) configuration.
Environment API provides a series of APIs related to the build environment.
162
+
Environment API provides some APIs related to the multi-environment build.
97
163
98
-
You can use environment API in [Rsbuild DevMiddleware](/config/dev/setup-middlewares) or [Custom Server](/api/javascript-api/instance#rsbuildcreatedevserver)to operate the build artifacts in a specific environment.
164
+
You can use environment API via [rsbuild.createDevServer()](/api/javascript-api/instance#rsbuildcreatedevserver) or [dev.setupMiddlewares](/config/dev/setup-middlewares), which allows you to get the build outputs information for a specific environment in the server side.
0 commit comments