refactor: simplify CSS rules and identifiers#7060
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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 focuses on refining and standardizing the internal configuration of CSS-related rules and identifiers across the core and various styling plugins. The changes aim to streamline the codebase by eliminating redundant explicit type declarations for CSS rules and enhancing consistency in rule naming conventions. These improvements contribute to a cleaner, more maintainable configuration system, aligning with recent loader advancements and Rsbuild v1 standards. 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.
Code Review
This pull request simplifies CSS rule definitions and standardizes identifiers, which is a positive step towards consistency. The removal of .type('javascript/auto') is a good cleanup. However, I've identified a potential regression in plugin-less, plugin-sass, and plugin-stylus where sideEffects is hardcoded to true. This makes the plugins more brittle, as they were previously inheriting this value dynamically. I've left comments with suggestions to revert these changes to maintain better decoupling and prevent potential future issues. The rest of the changes look good.
Deploying rsbuild with
|
| Latest commit: |
9ade292
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1af6d87a.rsbuild-v2.pages.dev |
| Branch Preview URL: | https://css-rules-0127.rsbuild-v2.pages.dev |
There was a problem hiding this comment.
Pull request overview
This PR refactors CSS-related webpack chain configurations by simplifying rule identifiers and removing unnecessary type specifications.
Changes:
- Removed explicit
.type('javascript/auto')settings from CSS rule definitions (no longer required per rspack/pull/12744) - Standardized rule IDs by removing
-mainsuffix (e.g.,css-main→css,sass-main→sass) to align with Rsbuild v1 conventions - Updated test snapshots to reflect the removal of
type: "javascript/auto"from CSS rule configurations
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/configChain.ts | Updated CHAIN_ID constants to remove -main suffix from CSS_MAIN and JS_MAIN identifiers |
| packages/core/src/plugins/css.ts | Removed .type('javascript/auto') calls from CSS inline and main rule definitions |
| packages/plugin-stylus/src/index.ts | Updated Stylus plugin to use simplified rule IDs, fixed startsWith() check, hardcoded sideEffects to true, and simplified v1 compatibility code |
| packages/plugin-sass/src/index.ts | Updated Sass plugin to use simplified rule IDs, fixed startsWith() check, hardcoded sideEffects to true, and simplified v1 compatibility code |
| packages/plugin-less/src/index.ts | Updated Less plugin to use simplified rule IDs, fixed startsWith() check, hardcoded sideEffects to true, and simplified v1 compatibility code |
| packages/core/tests/snapshots/*.snap | Updated test snapshots to remove "type": "javascript/auto" entries from CSS rule configurations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
.type('javascript/auto')setting from CSS rule definitions, as it is no longer necessary for correct loader behavior. See feat!: enable css by default rspack#12744.-mainsuffix to be consistent with Rsbuild v1.Checklist