Background image path not transformed when used in a shared CSS module #15410
Labels
bug: upstream
Bug in a dependency of Vite
feat: css
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
I am using Vite indirectly through Astro. I have a shared CSS module and compose its declarations in other CSS modules. When I link to a background image in this shared module, its URL remains unchanged in the output CSS, and doesn’t work. When I move the same background rule to a non-shared CSS module, everything works as expected: the URL of the background image is transformed to link to its actual location.
I reported this originally for Astro and received the recommendation to create an issue for Vite. This is likely related to madyankin/postcss-modules#149.
Reproduction
https://stackblitz.com/edit/github-dzmctt-mda7ss?file=src%2Fcomponents%2Fa.module.css
Steps to reproduce
By default the StackBlitz shows the working version. To see the bug, comment out the background definition in
a.module.css
, and uncomment it inshared.module.css
. You might need to restart Astro in the terminal by focusing it, pressing Ctrl+C, and runningastro dev
.System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: