Skip to content

fix(css): run final minification on merged CSS output#853

Merged
sxzz merged 2 commits intomainfrom
sxzz/fix-css-modules
Mar 22, 2026
Merged

fix(css): run final minification on merged CSS output#853
sxzz merged 2 commits intomainfrom
sxzz/fix-css-modules

Conversation

@sxzz
Copy link
Copy Markdown
Member

@sxzz sxzz commented Mar 22, 2026

  • This PR contains AI-generated code, but I have carefully reviewed it myself. Otherwise, my PR may be closed.

Description

Previously, LightningCSS minification was only applied per-file during the transform phase. When multiple CSS files share common imports (e.g. common.scss), the concatenated output contained duplicate rules that were never deduplicated. This adds a final LightningCSS transform() pass on the merged CSS in CssPostPlugin (similar to Vite's finalizeCss()), allowing cross-file rule deduplication when css.minify is enabled.

Linked Issues

fixes #851

Additional context

Only packages/css/src/post.ts is changed. The final minification pass runs in both splitting and non-splitting code paths.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 22, 2026

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 3a968ca
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/69bffefbffebdd00080fe65f
😎 Deploy Preview https://deploy-preview-853--tsdown-main.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 22, 2026

Open in StackBlitz

tsdown

pnpm add https://pkg.pr.new/tsdown@853 -D
npm i https://pkg.pr.new/tsdown@853 -D
yarn add https://pkg.pr.new/tsdown@853.tgz -D

create-tsdown

pnpm add https://pkg.pr.new/create-tsdown@853 -D
npm i https://pkg.pr.new/create-tsdown@853 -D
yarn add https://pkg.pr.new/create-tsdown@853.tgz -D

@tsdown/css

pnpm add https://pkg.pr.new/@tsdown/css@853 -D
npm i https://pkg.pr.new/@tsdown/css@853 -D
yarn add https://pkg.pr.new/@tsdown/css@853.tgz -D

@tsdown/exe

pnpm add https://pkg.pr.new/@tsdown/exe@853 -D
npm i https://pkg.pr.new/@tsdown/exe@853 -D
yarn add https://pkg.pr.new/@tsdown/exe@853.tgz -D

tsdown-migrate

pnpm add https://pkg.pr.new/tsdown-migrate@853 -D
npm i https://pkg.pr.new/tsdown-migrate@853 -D
yarn add https://pkg.pr.new/tsdown-migrate@853.tgz -D

commit: 3a968ca

@sxzz sxzz merged commit 475df0c into main Mar 22, 2026
15 checks passed
@sxzz sxzz deleted the sxzz/fix-css-modules branch March 22, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

css improve compression

1 participant