Skip to content

Commit a5e4463

Browse files
authored
docs: improve manifest data access instructions (#5164)
1 parent ec2d14a commit a5e4463

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

website/docs/en/api/javascript-api/environment-api.mdx

+9-3
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,7 @@ api.modifyRspackConfig((config, { environment }) => {
162162

163163
The manifest data. Only available when the [output.manifest](/config/output/manifest) config is enabled.
164164

165-
You should access the manifest data after the build has completed, using hooks like [onAfterBuild](/plugins/dev/hooks#onafterbuild), [onDevCompileDone](/plugins/dev/hooks#ondevcompiledone) and [onAfterEnvironmentCompile](/plugins/dev/hooks#onafterenvironmentcompile).
166-
167165
- **Type:** `Record<string, unknown> | ManifestData | undefined`
168-
169166
- **Example:**
170167

171168
```js
@@ -183,6 +180,15 @@ api.onAfterEnvironmentCompile(({ environment }) => {
183180
});
184181
```
185182

183+
The manifest data is only available after the build has completed, you can access it in the following hooks:
184+
185+
- [onAfterBuild](/plugins/dev/hooks#onafterbuild)
186+
- [onAfterEnvironmentCompile](/plugins/dev/hooks#onafterenvironmentcompile)
187+
- [onCloseBuild](/plugins/dev/hooks#onclosebuild)
188+
- [onCloseDevServer](/plugins/dev/hooks#onclosedevserver)
189+
- [onDevCompileDone](/plugins/dev/hooks#ondevcompiledone)
190+
- [onExit](/plugins/dev/hooks#onexit)
191+
186192
## Environment API
187193

188194
Environment API provides some APIs related to the multi-environment build.

website/docs/zh/api/javascript-api/environment-api.mdx

+9-3
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ api.modifyRspackConfig((config, { environment }) => {
163163

164164
manifest 文件数据。仅在 [output.manifest](/config/output/manifest) 配置被启用时才能访问。
165165

166-
你应该在构建完成后访问 manifest 数据,使用 hooks 如 [onAfterBuild](/plugins/dev/hooks#onafterbuild)[onDevCompileDone](/plugins/dev/hooks#ondevcompiledone)[onAfterEnvironmentCompile](/plugins/dev/hooks#onafterenvironmentcompile)
167-
168166
- **类型:** `Record<string, unknown> | ManifestData | undefined`
169-
170167
- **示例:**
171168

172169
```js
@@ -184,6 +181,15 @@ api.onAfterEnvironmentCompile(({ environment }) => {
184181
});
185182
```
186183

184+
manifest 数据仅在构建完成后才能被访问,你可以在以下 hooks 中访问:
185+
186+
- [onAfterBuild](/plugins/dev/hooks#onafterbuild)
187+
- [onAfterEnvironmentCompile](/plugins/dev/hooks#onafterenvironmentcompile)
188+
- [onCloseBuild](/plugins/dev/hooks#onclosebuild)
189+
- [onCloseDevServer](/plugins/dev/hooks#onclosedevserver)
190+
- [onDevCompileDone](/plugins/dev/hooks#ondevcompiledone)
191+
- [onExit](/plugins/dev/hooks#onexit)
192+
187193
## Environment API
188194

189195
Environment API 包了一些与多环境构建相关的 API。

0 commit comments

Comments
 (0)