From 6154e557a463013053ec92c97b476fe36cfa125b Mon Sep 17 00:00:00 2001 From: Tomas Madariaga Date: Tue, 18 Aug 2026 14:24:27 +0200 Subject: [PATCH] fix(packages/sui-bundler): keep plainCssPackages rules out of the link 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 --- .../sui-bundler/loaders/linkLoaderConfigBuilder.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/sui-bundler/loaders/linkLoaderConfigBuilder.js b/packages/sui-bundler/loaders/linkLoaderConfigBuilder.js index d7c4294da..0a5167caa 100644 --- a/packages/sui-bundler/loaders/linkLoaderConfigBuilder.js +++ b/packages/sui-bundler/loaders/linkLoaderConfigBuilder.js @@ -83,6 +83,20 @@ module.exports = ({config, packagesToLink, linkAll}) => { if (!regex.test('.css')) return rule + if (!Array.isArray(use)) return rule + + /** + * Only rules that already pipe through @s-ui/sass-loader need its importer + * replaced. Rules that don't (like the plainCssPackages passthrough) must be + * left untouched: injecting the sass loader there makes Sass parse plain CSS + * that isn't valid SCSS (e.g. Tailwind v4 output) and the build fails. + */ + const usesSassLoader = use.some(loaderEntry => + (typeof loaderEntry === 'string' ? loaderEntry : loaderEntry?.loader || '').includes('@s-ui/sass-loader') + ) + + if (!usesSassLoader) return rule + return { ...rule, use: [...use.slice(0, -1), sassLoaderWithLinkImporter]