Skip to content

Comments

feat(plugin-sass): compatible with Rsbuild v1#7055

Merged
chenjiahan merged 2 commits intomainfrom
plugin_sass_0126
Jan 26, 2026
Merged

feat(plugin-sass): compatible with Rsbuild v1#7055
chenjiahan merged 2 commits intomainfrom
plugin_sass_0126

Conversation

@chenjiahan
Copy link
Member

Summary

Added support for Rsbuild v1 in @rsbuild/plugin-sass by detecting the version and mapping rule IDs accordingly, ensuring that Sass processing works seamlessly across Rsbuild v1 and v2.

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings January 26, 2026 13:59
@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 significantly enhances the @rsbuild/plugin-sass by introducing full compatibility with Rsbuild v1. It achieves this by intelligently detecting the Rsbuild version at runtime and adjusting its internal configuration rule IDs to match the expected structure of either v1 or v2, ensuring that Sass compilation and processing function correctly across different Rsbuild environments without requiring separate plugin versions.

Highlights

  • Rsbuild v1 Compatibility: Introduced backward compatibility for @rsbuild/plugin-sass with Rsbuild v1, allowing seamless Sass processing across both v1 and v2 versions of Rsbuild.
  • Dynamic Rule ID Mapping: Implemented version detection logic within the Sass plugin to dynamically map internal rule IDs, adapting to differences in Rsbuild v1 and v2's configuration chaining.
  • Configuration Streamlining: Removed deprecated Sass-specific CHAIN_ID entries from the core configuration chain, streamlining the ID management.
  • Dependency Updates: Updated package.json to include @rsbuild/core-v1 as a dev dependency for testing and expanded the @rsbuild/core peer dependency range to support ^1.3.0.
  • Testing and Documentation: Added new test cases and updated snapshots to validate the Sass plugin's behavior and compatibility with Rsbuild v1, and revised documentation (English and Chinese) to reflect the removal of specific Sass ONE_OF rule IDs.
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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 26, 2026

Deploying rsbuild with  Cloudflare Pages  Cloudflare Pages

Latest commit: 605eaaa
Status: ✅  Deploy successful!
Preview URL: https://a48e559d.rsbuild-v2.pages.dev
Branch Preview URL: https://plugin-sass-0126.rsbuild-v2.pages.dev

View logs

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 PR adds support for Rsbuild v1 in the @rsbuild/plugin-sass by implementing version detection and conditional rule configuration. The plugin now maintains backward compatibility with Rsbuild v1.3.0+ while also supporting Rsbuild v2, avoiding the need for a major version bump.

Changes:

  • Added version detection using api.context.version.startsWith('1.') to conditionally handle v1 vs v2 rule structures
  • Removed SASS-specific CHAIN_ID constants from core (SASS_MAIN, SASS_RAW, SASS_INLINE) as they are now internally managed by the plugin
  • Updated peer dependency requirement from ^1.0.0 to ^1.3.0 to ensure the context.version API is available

Reviewed changes

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

Show a summary per file
File Description
packages/plugin-sass/src/index.ts Implemented version detection and conditional rule configuration logic using a getRule helper function that maps between v1 flat rule structure and v2 oneOf rule structure
packages/core/src/configChain.ts Removed SASS_MAIN, SASS_RAW, and SASS_INLINE constants from CHAIN_ID.ONE_OF as they are now plugin-internal
website/docs/en/config/tools/bundler-chain.mdx Removed documentation for deprecated SASS ONE_OF chain IDs
website/docs/zh/config/tools/bundler-chain.mdx Removed documentation for deprecated SASS ONE_OF chain IDs (Chinese version)
packages/plugin-sass/tests/index.test.ts Added test case for Rsbuild v1 compatibility using the v1 dev dependency
packages/plugin-sass/tests/snapshots/index.test.ts.snap Updated snapshots reflecting structural differences between v1 (flat rules) and v2 (oneOf rules), and added new v1-specific snapshot
packages/plugin-sass/package.json Added @rsbuild/core-v1 dev dependency for testing and updated peer dependency to ^1.3.0 || ^2.0.0-0
pnpm-lock.yaml Updated lock file to include the new @rsbuild/core-v1 dev dependency
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

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 introduces compatibility for Rsbuild v1 in the plugin-sass package. The changes are well-structured, detecting the Rsbuild version and using a compatibility layer (getRule function) to handle differences in webpack rule configuration between v1 and v2. The decoupling of Sass-specific chain IDs from @rsbuild/core is a good move for maintainability. The addition of a new test case specifically for v1 ensures the changes are well-tested.

My review includes one suggestion to improve maintainability by removing redundant constants and relying on CHAIN_ID from @rsbuild/core for CSS-related rule names.

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: 67a49e880a

ℹ️ 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".

@chenjiahan chenjiahan merged commit 0a42c27 into main Jan 26, 2026
6 of 14 checks passed
@chenjiahan chenjiahan deleted the plugin_sass_0126 branch January 26, 2026 14:34
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