Skip to content

fix(css): detect css modules from full id for vue virtual sfc styles#917

Merged
sxzz merged 1 commit intomainfrom
issue-916
Apr 16, 2026
Merged

fix(css): detect css modules from full id for vue virtual sfc styles#917
sxzz merged 1 commit intomainfrom
issue-916

Conversation

@sxzz
Copy link
Copy Markdown
Member

@sxzz sxzz commented Apr 16, 2026

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

Description

tsdown's @tsdown/css plugin was matching CSS_MODULE_RE against the cleaned path (everything before ?), so Vue SFC virtual modules like Component.vue?vue&type=style&index=0&lang.module.css were never treated as CSS modules — the module map stayed empty and rolldown errored with "default" is not exported. Matching against the full id (including query) aligns with Vite (packages/vite/src/node/plugins/css.ts:1513) and fixes the build.

Linked Issues

fixes #916

Additional context

Added a regression test under tests/issues.test.ts using unplugin-vue/rolldown with a <style module> block; the snapshot at tests/__snapshots__/issues/916.snap.md confirms { "btn": "mod_btn" } is exported and .mod_btn appears in the emitted CSS.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 16, 2026

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 9e37d23
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/69e082a86e738f0008801a44
😎 Deploy Preview https://deploy-preview-917--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 Apr 16, 2026

Open in StackBlitz

tsdown

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

create-tsdown

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

@tsdown/css

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

@tsdown/exe

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

tsdown-migrate

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

commit: 9e37d23

@sxzz sxzz merged commit e6021f5 into main Apr 16, 2026
15 checks passed
@sxzz sxzz deleted the issue-916 branch April 16, 2026 06:43
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.

Cannot bundle Vue with <style module>

1 participant