fix(plugin-react): failed to split chunks with Rsbuild v1#7109
fix(plugin-react): failed to split chunks with Rsbuild v1#7109chenjiahan merged 2 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 resolves an issue where the chunk splitting mechanism in the React plugin was not correctly applied when building with Rsbuild v1. The changes involve refining the logic that determines the default chunk splitting preset and introducing new tests to validate the configuration's behavior with the older Rsbuild version, thereby ensuring consistent and expected module optimization. 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
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 650a471cc2
ℹ️ 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".
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where splitChunks configuration from @rsbuild/plugin-react was not working with Rsbuild v1. The change simplifies the condition for detecting the default preset to correctly handle legacy configurations. While this fixes the issue for v1, it could introduce inconsistencies with newer Rsbuild versions where splitChunks should take precedence over the deprecated performance.chunkSplit. I've suggested a more robust implementation that aligns with the core behavior across different versions.
There was a problem hiding this comment.
Pull request overview
Fixes @rsbuild/plugin-react chunk splitting behavior to work correctly with Rsbuild 1.x, and adds coverage to ensure the expected splitChunks config is produced.
Changes:
- Add an Rsbuild v1 test case (via
@rsbuild/core-v1) assertingoptimization.splitChunksoutput. - Adjust
isDefaultPresetlogic insplitChunks.tsto treat legacyperformance.chunkSplitas the trigger. - Update snapshots and dependencies to support running tests against Rsbuild v1.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds the @rsbuild/core-v1 alias dependency to the plugin-react importer. |
| packages/plugin-react/tests/index.test.ts | Adds a new Rsbuild v1 test asserting splitChunks output. |
| packages/plugin-react/tests/snapshots/index.test.ts.snap | Adds snapshot for the new Rsbuild v1 test case. |
| packages/plugin-react/src/splitChunks.ts | Updates default-preset detection logic for legacy chunkSplit compatibility. |
| packages/plugin-react/package.json | Adds @rsbuild/core-v1 as a dev dependency for test execution. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Ensuring that the splitChunks configuration of
@rsbuild/plugin-reactworks as expected with Rsbuild 1.x.Checklist