Skip to content

Comments

fix(plugin-react): failed to split chunks with Rsbuild v1#7109

Merged
chenjiahan merged 2 commits intomainfrom
plugin_react_split_0202
Feb 2, 2026
Merged

fix(plugin-react): failed to split chunks with Rsbuild v1#7109
chenjiahan merged 2 commits intomainfrom
plugin_react_split_0202

Conversation

@chenjiahan
Copy link
Member

Summary

Ensuring that the splitChunks configuration of @rsbuild/plugin-react works as expected with Rsbuild 1.x.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings February 2, 2026 03:25
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Rsbuild v1 Compatibility: Ensured that the splitChunks configuration within @rsbuild/plugin-react functions correctly when used with Rsbuild v1, addressing a previous failure.
  • Configuration Logic Refinement: Adjusted the isDefaultPreset function in src/splitChunks.ts to simplify the condition for performance.chunkSplit, improving how the default chunk splitting strategy is determined.
  • New Test Coverage: Added a dedicated test case to verify the splitChunks configuration specifically for Rsbuild v1, including a new snapshot to capture the expected output.
  • Development Dependency: Introduced @rsbuild/core-v1 as a development dependency, aliasing @rsbuild/core@^1.7.2, to enable testing against the specific Rsbuild v1 version.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) asserting optimization.splitChunks output.
  • Adjust isDefaultPreset logic in splitChunks.ts to treat legacy performance.chunkSplit as 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.

@chenjiahan chenjiahan merged commit b0a546d into main Feb 2, 2026
12 checks passed
@chenjiahan chenjiahan deleted the plugin_react_split_0202 branch February 2, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant