fix(packages/sui-bundler): keep plainCssPackages rules out of the link sass loader - #1994
Merged
Merged
Conversation
…k sass loader When linking packages (-l / -L) the link config builder rewrote every rule whose test matched .css, replacing its last loader with @s-ui/sass-loader. That also hit the plainCssPackages passthrough rule, so plain CSS shipped by packages such as Tailwind v4 output was parsed as SCSS and the build failed with "Error: Expected digit". Now only rules that already pipe through @s-ui/sass-loader get its importer replaced; every other rule is left untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
tomasmax
requested review from
andresin87,
andresz1,
ferransimon,
kikoruiz and
sui-bot
as code owners
August 18, 2026 12:25
maiderhernandorena-del
approved these changes
Aug 18, 2026
stivaliserna
approved these changes
Aug 18, 2026
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.
Problem
plainCssPackages(added in #1988, released in v9.79.0) has no effect when the bundler runs with link flags (-l/-L).loaders/linkLoaderConfigBuilder.jsrewrote every rule whosetestmatched.css, swapping its last loader for@s-ui/sass-loaderwith the link importer. That also hit theplainCssPackagespassthrough rule ([style-loader, css-loader]), turning it into[style-loader, @s-ui/sass-loader]. Plain CSS then went through Sass and the build died:Reproduced in
frontend-mt--web-app, whosedev_cochestarget passes-l ../packages/domain … -L ../packages/uiand declaresplainCssPackages: ["@adv-mt/ui", "@adv-mt/theme"](Tailwind v4 output — not valid SCSS).Fix
Only replace the sass importer on rules that already pipe through
@s-ui/sass-loader. Any other rule is returned untouched, so theplainCssPackagespassthrough survives link mode. Also bails out whenuseisn't an array.Verification
Ran the builder over a config mirroring
webpack.config.dev.js(sass rule + plainCssPackages passthrough + a JS rule) withpackagesToLinkset:@s-ui/sass-loader✅[style-loader, css-loader], unchanged ✅Before the fix the second rule became
[style-loader, @s-ui/sass-loader].sui-lint jsreports 0 errors on the touched file (only pre-existingsui/commonjswarnings).🤖 Generated with Claude Code