-
-
Notifications
You must be signed in to change notification settings - Fork 249
feat: support get environment context via environment API #5334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for retrieving the build manifest via the Environment API by introducing a new getManifest method, updating type definitions and docs, and covering it in an end-to-end test.
- Introduces
getManifestinEnvironmentAPItypes and implements it in the dev server - Updates both Chinese and English docs with usage examples and API details
- Adds an E2E test to verify manifest retrieval via the Environment API
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/zh/config/output/manifest.mdx | Mention Environment API for manifest access |
| website/docs/en/config/output/manifest.mdx | Mention Environment API for manifest access |
| website/docs/zh/api/javascript-api/environment-api.mdx | Add getManifest API docs and type signature (Chinese) |
| website/docs/en/api/javascript-api/environment-api.mdx | Add getManifest API docs and type signature (English) |
| packages/core/src/types/hooks.ts | Reference Environment API in manifest context comments |
| packages/core/src/types/config.ts | Add getManifest to EnvironmentAPI type |
| packages/core/src/server/devServer.ts | Implement getManifest method in dev server |
| e2e/cases/output/manifest-environment/index.test.ts | E2E test for getManifest |
chenjiahan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the plugin hooks to get the manifest?
See: https://rsbuild.rs/api/javascript-api/environment-api#manifest
If we want to use plugin hooks in devServer to get webManifest, the example is as follows, which is not very convenient. let webManifest;
api.onDevCompileDone(({ environments }) => {
webManifest = environments.web.manifest;
});
// ...
const { } = webManifest; |
|
Since the const { manifest } = await environments.web.context;
console.log(manifest?.entries); |
It's also great to get manifest through context, do you mean https://rsbuild.rs/api/javascript-api/instance#rsbuildcontext |

Summary
support get environment context via environment API.
https://rsbuild.rs/api/javascript-api/environment-api#environment-context
Related Links
Checklist