Skip to content

fix(css): respect Lightning CSS modules options - #1103

Merged
sxzz merged 1 commit into
mainfrom
codex/fix-lightningcss-modules-options
Oct 23, 2026
Merged

sxzz merged 1 commit into
mainfrom
codex/fix-lightningcss-modules-options

Conversation

@sxzz

@sxzz sxzz commented Oct 23, 2026

Copy link
Copy Markdown
Member

Description

css.lightningcss.cssModules was overwritten by the internally resolved CSS Modules configuration, so options such as animation: false had no effect. Merge these options in resolveCssModulesConfig, preserving tsdown's naming overrides and applying them only to CSS modules. Ordinary CSS and final minification do not enable module scoping.

Add eight regression cases covering CSS and SCSS, minification, naming precedence, ordinary CSS, and disabled CSS Modules.

Linked Issues

Closes #1083

Additional context

Validation: pnpm lint, pnpm typecheck, and Prettier checks passed. CSS tests: 134 passed, with 3 existing expected failures.

Merge Lightning CSS modules options only for CSS modules, preserving tsdown naming overrides and avoiding repeated scoping during minification.

Closes #1083
Copilot AI balanced review requested due to automatic review settings October 23, 2026 12:34
@netlify

netlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 99986e5
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/6adb5446b2176e1aeefdd6d6
😎 Deploy Preview https://deploy-preview-1103--tsdown-main.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

tsdown

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

create-tsdown

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

@tsdown/css

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

@tsdown/exe

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

tsdown-migrate

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

commit: 99986e5

@sxzz
sxzz merged commit 490ecd6 into main Oct 23, 2026
18 checks passed
@sxzz
sxzz deleted the codex/fix-lightningcss-modules-options branch October 23, 2026 12:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change preserves naming precedence and module boundaries, with regression coverage for the affected paths and no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes #1083 by preserving Lightning CSS module options such as animation: false in tsdown’s CSS processing, while retaining tsdown’s naming precedence.

Changes:

  • Merge Lightning CSS module options into the resolved module configuration.
  • Preserve existing scoping boundaries for ordinary CSS and disabled CSS Modules.
  • Add eight regression cases and snapshots covering CSS, SCSS, minification, and naming precedence.
File Description
tests/​css-modules.test.ts Adds eight regression cases for module options and scoping.
tests/​__snapshots__/​lightningcss-css-modules-options/​preserves-animation-names-with-scss-and-minify-true.snap.md Records preserved animation names in minified SCSS output.
tests/​__snapshots__/​lightningcss-css-modules-options/​preserves-animation-names-with-scss-and-minify-false.snap.md Records preserved animation names in unminified SCSS output.
tests/​__snapshots__/​lightningcss-css-modules-options/​preserves-animation-names-with-css-and-minify-true.snap.md Records preserved animation names in minified CSS output.
tests/​__snapshots__/​lightningcss-css-modules-options/​preserves-animation-names-with-css-and-minify-false.snap.md Records preserved animation names in unminified CSS output.
tests/​__snapshots__/​lightningcss-css-modules-options/​prefers-tsdown-modules-options-for-fade.snap.md Records global naming precedence.
tests/​__snapshots__/​lightningcss-css-modules-options/​prefers-tsdown-modules-options-for-custom_fade.snap.md Records custom naming precedence.
tests/​__snapshots__/​lightningcss-css-modules-options/​does-not-scope-app-module-css-with-modules-false.snap.md Records unscoped output when modules are disabled.
tests/​__snapshots__/​lightningcss-css-modules-options/​does-not-scope-app-css-with-modules-undefined.snap.md Records unscoped ordinary CSS output.
packages/​css/​src/​plugin.ts Merges Lightning CSS options before applying tsdown naming overrides.

Review effort: Balanced

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.

animation: false lightningcss option not working

2 participants