fix(sui-bundler): don't force sass-loader on plainCssPackages when linking - #1993
Open
tomasmax wants to merge 1 commit into
Open
fix(sui-bundler): don't force sass-loader on plainCssPackages when linking#1993tomasmax wants to merge 1 commit into
tomasmax wants to merge 1 commit into
Conversation
…s when linking linkLoaderConfigBuilder rewrote the last loader of every module rule whose test matched .css to inject @s-ui/sass-loader with the link importer — including the plainCssPackages passthrough rule (added in #1988), which is meant to skip sass-loader entirely for packages that ship pre-built plain CSS. This broke consumers linking local packages via -l/-L (a standard dev workflow in monorepos) whenever any plainCssPackages dependency shipped modern CSS syntax (e.g. Tailwind v4's @layer/@supports), since sass-loader can't parse it. Only rewrite rules that already use @s-ui/sass-loader, compared by resolved path so this also holds when @s-ui/sass-loader itself is linked (its resolved path won't contain the package name substring). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
tomasmax
requested review from
andresin87,
andresz1,
ferransimon,
kikoruiz and
sui-bot
as code owners
August 6, 2026 09:40
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
linkLoaderConfigBuilder(used bysui-bundler dev -l/-Landsui-bundler build -l/-Lfor local package linking) rewrites the last loader of every module rule whosetestmatches.css, injecting@s-ui/sass-loaderwith the link importer.plainCssPackagespassthrough rule added in feat(sui-bundler): add plainCssPackages config to bypass sass-loader #1988, which exists specifically to make webpack treat certain packages'.cssas plain CSS and skip sass-loader entirely.plainCssPackagesfor a dependency shipping modern CSS (e.g. Tailwind v4's@layer/@supportssyntax) gets that CSS silently routed through sass-loader anyway, which can't parse it →Module parse failedat dev-server startup.usechain already includes@s-ui/sass-loader, compared byrequire.resolved path (not a package-name substring — needed so this still works when@s-ui/sass-loaderitself is linked, where its resolved path ispackages/sui-sass-loader/src/index.jsand doesn't contain the package name).Test plan
packages/sui-bundler/test/server/linkLoaderConfigBuilderSpec.js: asserts the sass-loader rule still gets the link importer injected, theplainCssPackagespassthrough rule is left untouched, and the no-op case (nothing to link) returns config unchanged.npx @s-ui/test server -P 'packages/sui-bundler/test/server/*Spec.js'— 15 passing (includes pre-existinglinkLoaderSpec,plainCssSplitChunksSpec, integration specs).sui-lint js --fix— 0 errors (pre-existingsui/commonjswarnings elsewhere in the package, not introduced by this change).npm run test && npm run types:check) passed: 595 client tests, 18 server tests, typecheck clean.frontend-mt--web-app, runningdev:cocheswith-l ../packages/domain -l ../packages/literals -l ../packages/segment-wrapper -l ../packages/theme -L ../packages/uiandplainCssPackages: ["@adv-mt/ui", "@adv-mt/theme"]): before the fix, dev server failed to compile withModule parse failed: Unexpected tokenon@adv-mt/theme/dist/tokens.cssand@adv-mt/ui/dist/basic/button/styles.css; after patching locally, dev server compiled and served correctly.🤖 Generated with Claude Code