chore(build): simplify rspack runtime replacement plugin#7026
chore(build): simplify rspack runtime replacement plugin#7026chenjiahan merged 3 commits intomainfrom
Conversation
Summary of ChangesHello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request streamlines the build process by refactoring a custom Rspack runtime replacement mechanism. It transitions from a class-based Rspack plugin to a more integrated Rsbuild plugin, simplifying the logic for replacing runtime globals within bundled assets. This change enhances the maintainability and clarity of the build configuration by aligning it more closely with the Rsbuild plugin architecture. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Deploying rsbuild with
|
| Latest commit: |
fdc2e48
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://19403279.rsbuild-v2.pages.dev |
| Branch Preview URL: | https://simplify-plugin-0124.rsbuild-v2.pages.dev |
There was a problem hiding this comment.
Code Review
This pull request successfully simplifies the rspack runtime replacement plugin by refactoring it into a native Rsbuild plugin. The new implementation is more concise and maintainable by using the api.processAssets helper, and the logic remains correct. The associated changes to dependencies and type imports are also consistent and well-executed. This is a solid improvement to the build configuration.
There was a problem hiding this comment.
Pull request overview
Replaces a custom Rspack compiler plugin used for post-bundle runtime placeholder replacement with an Rsbuild plugin, and adjusts related build config typing/dependencies.
Changes:
- Refactors runtime placeholder replacement from
RspackRuntimeReplacePlugin(Rspack compiler hook) to an RsbuildprocessAssetsplugin. - Updates shared build config typing to reference
Rsbuild.*types from@rslib/core. - Removes
@rsbuild/corefromscripts/configdevDependencies and updates the lockfile resolution accordingly.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/config/rslib.config.ts | Switches minify type annotation to Rsbuild.Minify via @rslib/core types. |
| scripts/config/package.json | Removes @rsbuild/core from devDependencies. |
| pnpm-lock.yaml | Updates dependency graph/peer resolution for scripts/config, including @rsbuild/core version selection. |
| packages/core/rslib.config.ts | Replaces the custom Rspack plugin with an Rsbuild processAssets plugin and registers it for the client build. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
scripts/config/package.json:12
rsbuild-plugin-arethetypeswrongdeclares@rsbuild/coreas an (optional) peer dependency, and removing@rsbuild/corefrom this package causes pnpm to auto-install a registry@rsbuild/coreversion (see lockfile now pulling@rsbuild/[email protected]). This can lead to multiple@rsbuild/corecopies/versions in the workspace and make plugin behavior harder to reason about. Consider either keeping@rsbuild/coreas aworkspace:*devDependency here, or explicitly configuring pnpm to not auto-install this peer for this package (e.g., peerDependencyRules/overrides) if you intentionally want it absent.
"devDependencies": {
"@rslib/core": "0.19.2",
"@types/node": "^24.10.9",
"@typescript/native-preview": "^7.0.0-dev.20260118.1",
"rsbuild-plugin-arethetypeswrong": "0.1.1",
"typescript": "^5.9.3"
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Summary
Replaced the
RspackRuntimeReplacePluginwith areplacePluginRsbuild plugin, simplifying plugin registration and asset processing logic.Related
Checklist