With the default lightningcss transformer, a cross-file composes inside a Vue SFC <style module> block is not resolved.
The generated class map contains the bare, unhashed composed class name, and the composed file's CSS is never emitted, so the class matches nothing.
The same composes in a standalone *.module.css file works, and so does the SFC case with css.transformer: "postcss".
The SFC's composed class is the literal reset. Only the copy reached via plain.module.css lands in style.css (.o_hNsG_reset), so the SFC button gets no reset styles.
Any additional comments?
Cause (as far as I can tell)
SFC style ids carry a ?vue&type=style… query, so they go through transformWithLightningCSS (lightningcss transform), not bundleWithLightningCSS.
In transform mode lightningcss does not load other files: a cross-file composes comes back as a reference with type: "dependency" and a specifier, which the caller has to resolve, compile and hash.
extractLightningCssModuleExports in packages/css/src/modules.ts appends only c.name for every reference and ignores type/specifier:
for (const c of value.composes) {
name += ` ${c.name}`
`extractLightningCssModuleExports` in `packages/css/src/modules.ts` appends only `c.name` for every reference and ignores `type`/`specifier`:
```ts
for (const c of value.composes) {
name += ` ${c.name}`
}
So dependency references end up as their raw local name and the dependency is never added to the build.
Ideally the transform path would resolve dependency references (as Vite does) or at least fail loudly instead of emitting a class that matches nothing.
Related but different: #979 / #1115 (duplicated composed rules).
System info
tsdown 0.23.7, @tsdown/css 0.23.7 (also reproduced on 0.23.0)
lightningcss 1.33.0
unplugin-vue 8.0.1, vue 3.5.45
postcss-modules 9.0.1 (for the working postcss comparison)