CSS pseudo selector with nested media query produces wrong styles in production mode #20006
Open
7 tasks done
Labels
bug: upstream
Bug in a dependency of Vite
feat: css
has workaround
p2-edge-case
Bug, but has workaround or limited in scope (priority)
Describe the bug
The following styles
in production mode gets compiled into
where the media query block loses the selector.
In dev mode the styles output is correct.
Reproduction
https://github.com/7nik/vite-css-media-nested-in-pseudoelem
Steps to reproduce
npm install
npm run dev
— open http://localhost:5173/, the text background should be rednpm run build & npm run preview
— open http://localhost:4173/, the text background should be red, but isn'tSystem Info
System: OS: Linux 6.6 Manjaro Linux CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K Memory: 22.04 GB / 31.09 GB Container: Yes Shell: 5.2.37 - /bin/bash Binaries: Node: 23.9.0 - /usr/bin/node Yarn: 1.22.22 - /usr/bin/yarn npm: 11.3.0 - /usr/bin/npm pnpm: 10.9.0 - /usr/bin/pnpm Browsers: Brave Browser: 134.1.76.81 Chromium: 136.0.7103.59 npmPackages: vite: ^6.3.1 => 6.3.5
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: