You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@value or composes using other modules bypasses other postcss plugins #149
I'm using Vite 4.0.4 (in a react project) which uses this postcss plugin for CSS Modules support.
I am also using the postcss-nesting plugin in my project. It appears that when classes are imported using the @value or composes syntax, the imported CSS bypasses other postcss plugins. In my case, this means nested CSS is leaking into my output.
For example when I use composes on a class in another modules file (which has nested CSS):
composes: formfield from '../../forms.module.css';
All of the nested code gets printed to the DOM - it somehow was not parsed into output CSS.
In textarea.module.css:
.textarea{composes: formfield from '../../forms.module.css';}
Can confirm this happens to me too when using @value from .... I'm just trying to import an external class from another file because I need to use it in a complex selector, but it breaks my file in multiple ways (nesting and other plugins like postcss-simple-vars).
Activity
romainmenke commentedon Jan 22, 2023
In PostCSS API terms :
It seems that CSS Modules related logic runs on
OnceExit.Any CSS inlined/imported through
composeswon't be processed by plugins that run on earlier events likeRule.arty-name commentedon Dec 22, 2023
I also use postcss-modules indirectly: through Vite and Astro. Looks like it is causing broken background URLs for me, as demonstrated here
alvaro-cuesta commentedon May 2, 2024
Can confirm this happens to me too when using
@value from .... I'm just trying to import an external class from another file because I need to use it in a complex selector, but it breaks my file in multiple ways (nesting and other plugins likepostcss-simple-vars).tomdrewes commentedon Sep 10, 2026
Using PostCSS through Vite and would love to see @soreavis PR land. Thank you!
Preserve source files on CSS prepended from composed dependencies