Open privatenumber opened 10 months ago
Start a new pull request in StackBlitz Codeflow.
I actually managed to reproduce this with PostCSS too: https://stackblitz.com/edit/vitejs-vite-vhmmza?file=comp-a%2Findex.js
In both cases, it seems like anything CSSModules imports is handled outside of Vite and so shared dependencies are duplicated, creating unpredictable behavior based on what gets loaded on the page first.
Describe the bug
I'm facing a problem with the
composes
feature in CSS Modules using LightningCSS. It seems to duplicate the base class it's composing, causing a re-declaration. Consequently, this re-declaration overwrites styles from components loaded earlier that also composes the same base class, dominating in specificity and altering their intended look.Disabling LightningCSS resolves the issue, but there are other problems with PostCSS (e.g., https://github.com/vitejs/vite/issues/10079).
Reproduction
https://stackblitz.com/edit/vitejs-vite-vf7fy6?file=vite.config.js
Steps to reproduce
Just load the StackBlitz.
For context, I'm encountering this problem in a Vue.js app. But the reproduction minimizes it down to just JS + CSS Modules.
System Info
Used Package Manager
npm
Logs
No response
Validations