feat: add support for native html plugin implementation#6504
feat: add support for native html plugin implementation#6504chenjiahan merged 4 commits intomainfrom
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.
Pull Request Overview
This PR adds support for configuring HTML generation implementation in Rsbuild, allowing users to choose between the JavaScript-based html-rspack-plugin and Rspack's native Rust-based HtmlRspackPlugin. The implementation is made configurable via the new html.implementation option.
Key changes:
- Introduces a new
html.implementationconfiguration option ('js'or'native') with'js'as the default - Refactors HTML plugin resolution to be dynamic based on the configuration
- Updates all plugin instances to receive the HTML plugin resolver as a dependency injection
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/types/config.ts | Adds HtmlImplementation type and implementation field to HtmlConfig |
| packages/core/src/defaultConfig.ts | Sets default value of implementation to 'js' |
| packages/core/src/pluginHelper.ts | Updates getHTMLPlugin to accept config and return appropriate plugin based on implementation setting |
| packages/core/src/provider/rspackConfig.ts | Passes environment config to getHTMLPlugin call |
| packages/core/src/plugins/html.ts | Creates local getHTMLPlugin function and passes it to RsbuildHtmlPlugin |
| packages/core/src/plugins/resourceHints.ts | Imports and passes getHTMLPlugin function to resource hints plugins |
| packages/core/src/rspack-plugins/RsbuildHtmlPlugin.ts | Accepts getHTMLPlugin function as constructor parameter and removes direct import |
| packages/core/src/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.ts | Accepts getHTMLPlugin function as constructor parameter and removes direct import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Summary
implementationoption to html config to allow switching between js and native html pluginsChecklist