fix: make CSS preprocessor plugins compat with Rsbuild 1.2#4909
Merged
chenjiahan merged 2 commits intoweb-infra-dev:mainfrom Mar 29, 2025
Merged
fix: make CSS preprocessor plugins compat with Rsbuild 1.2#4909chenjiahan merged 2 commits intoweb-infra-dev:mainfrom
chenjiahan merged 2 commits intoweb-infra-dev:mainfrom
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
colinaaa
commented
Mar 28, 2025
|
|
||
| // Support for importing raw Sass files | ||
| chain.module | ||
| .rule(CHAIN_ID.RULE.SASS_RAW) |
Contributor
Author
There was a problem hiding this comment.
CHAIN_ID.RULE.SASS_RAW is undefined in v1.2.x. So we will get a rule like this:
/* config.module.rule('undefined') */
{
test: /\.s(?:a|c)ss$/,
resourceQuery: /raw/,
type: 'asset/source'
},
I'll make a patch in the next PR
Suggested change
| .rule(CHAIN_ID.RULE.SASS_RAW) | |
| .rule(CHAIN_ID.RULE.SASS_RAW ?? "sass-raw") |
colinaaa
commented
Mar 28, 2025
| callback(inlineRule, 'inline'); | ||
|
|
||
| // Rsbuild < 1.3.0 does not have RULE.CSS_INLINE. | ||
| if (chain.module.rules.has(CHAIN_ID.RULE.CSS_INLINE)) { |
Contributor
Author
There was a problem hiding this comment.
It might be preferable to use CHAIN_ID.RULE.CSS_INLINE && chain.module.rules.has(CHAIN_ID.RULE.CSS_INLINE) because, theoretically, there could be a rule named undefined.
chenjiahan
reviewed
Mar 29, 2025
| // Rsbuild < 1.3.0 does not have RULE.CSS_INLINE. | ||
| if (chain.module.rules.has(CHAIN_ID.RULE.CSS_INLINE)) { | ||
| const inlineRule = chain.module | ||
| .rule(findRuleId(chain, CHAIN_ID.RULE.LESS_INLINE)) |
Member
There was a problem hiding this comment.
findRuleId should not be put inside the updateRules method. It should be only called once.
chenjiahan
approved these changes
Mar 29, 2025
This was referenced Mar 29, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Ensure compatibility of plugin-less, plugin-sass, and plugin-stylus with Rsbuild 1.2.x.
Related Links
See lynx-family/lynx-stack#386.
Checklist