Skip to content

Comments

fix: replace bundler with rspack in bundlerChain config#7143

Merged
chenjiahan merged 2 commits intomainfrom
bundler_chain_params_0204
Feb 4, 2026
Merged

fix: replace bundler with rspack in bundlerChain config#7143
chenjiahan merged 2 commits intomainfrom
bundler_chain_params_0204

Conversation

@chenjiahan
Copy link
Member

Summary

  • Refactors how Rspack instance are accessed via tools.bundlerChain, simplifying the usage from destructured plugin objects to the direct use of the rspack object.
  • Marking the old bundler property as deprecated.

Checklist

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

Copilot AI review requested due to automatic review settings February 4, 2026 13:51
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@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 refactors the way Rspack instances and their associated plugins are accessed within the tools.bundlerChain configuration. By replacing the bundler parameter with a direct rspack object, the changes streamline plugin usage and improve code clarity. The old bundler property is now deprecated, guiding developers towards a more direct and simplified integration pattern for Rspack functionalities.

Highlights

  • API Parameter Renaming: The bundler parameter in the modifyBundlerChain callback has been consistently replaced with rspack across multiple plugin files (basic.ts, define.ts, sourceMap.ts).
  • Simplified Rspack Plugin Access: Rspack plugins are now accessed directly via the rspack object (e.g., rspack.HotModuleReplacementPlugin) instead of through a destructured bundler object, simplifying plugin integration.
  • Type Definition Update and Deprecation: The ModifyBundlerChainUtils type has been updated to reflect this change, making the bundler property directly typeof rspack and marking it as @deprecated to encourage the new rspack usage.
  • Code Cleanup: Intermediate destructuring of Rspack plugins in rspackConfig.ts has been removed, leading to cleaner and more direct code.
Changelog
  • packages/core/src/plugins/basic.ts
    • Updated api.modifyBundlerChain callback signature to use rspack instead of bundler.
    • Changed HotModuleReplacementPlugin usage from bundler.HotModuleReplacementPlugin to rspack.HotModuleReplacementPlugin.
  • packages/core/src/plugins/define.ts
    • Updated api.modifyBundlerChain callback signature to use rspack instead of bundler.
    • Changed DefinePlugin usage from bundler.DefinePlugin to rspack.DefinePlugin.
  • packages/core/src/plugins/sourceMap.ts
    • Updated api.modifyBundlerChain callback signature to use rspack instead of bundler.
    • Changed SourceMapDevToolPlugin usage from bundler.SourceMapDevToolPlugin to rspack.SourceMapDevToolPlugin.
  • packages/core/src/rspackConfig.ts
    • Removed explicit destructuring of Rspack plugins.
    • Modified bundler property in modifyBundlerChain to directly reference the rspack object.
  • packages/core/src/types/hooks.ts
    • Removed the PluginInstance interface.
    • Updated ModifyBundlerChainUtils type to define bundler as typeof rspack.
    • Added @deprecated JSDoc tag to the bundler property in ModifyBundlerChainUtils.
Activity
  • No specific review comments or activity recorded yet.
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
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 is a well-executed refactoring that simplifies how the Rspack instance is accessed within the modifyBundlerChain hook. It deprecates the old bundler property in favor of the rspack property on the utility object, making the API more consistent and straightforward. The bundler property is maintained as an alias to rspack for backward compatibility, which is a good practice. The internal plugins have been updated to use the new rspack property, serving as a clear example for migration. The type definitions are also updated correctly to reflect these changes. Overall, this is a solid improvement with no apparent issues.

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

This pull request refactors how Rspack instances are accessed via tools.bundlerChain by replacing the limited bundler object with direct access to the rspack module, while maintaining backward compatibility through deprecation.

Changes:

  • Simplified type definitions by replacing the limited bundler object with typeof rspack
  • Updated all internal plugin files to use rspack instead of bundler
  • Marked the bundler property as deprecated to guide users toward the new approach

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/core/src/types/hooks.ts Updated ModifyBundlerChainUtils to deprecate bundler and type it as typeof rspack instead of a limited plugin object
packages/core/src/rspackConfig.ts Simplified implementation by passing rspack directly as bundler instead of destructuring specific plugins
packages/core/src/plugins/sourceMap.ts Updated to use rspack parameter instead of bundler
packages/core/src/plugins/define.ts Updated to use rspack parameter instead of bundler
packages/core/src/plugins/basic.ts Updated to use rspack parameter instead of bundler

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cloudflare-workers-and-pages
Copy link

@chenjiahan chenjiahan merged commit 4318874 into main Feb 4, 2026
6 checks passed
@chenjiahan chenjiahan deleted the bundler_chain_params_0204 branch February 4, 2026 13:58
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