vite build
produces incorrectly flattened nested CSS
#18974
Labels
bug: upstream
Bug in a dependency of Vite
feat: css
p3-downstream-blocker
Blocking the downstream ecosystem to work properly (priority)
Describe the bug
When using modern CSS with nesting, a production build will generate invalid CSS.
Given the following CSS:
In a production build, this is flattened as:
This CSS is invalid because
:where(…)
doesn't accept relative selectors.But I expect it to be flattened as this instead:
Note: in dev mode (
vite dev
) it works as expected.Reproduction
https://github.com/RobinMalfait/vite-incorrect-css-flattening
Steps to reproduce
npm install
npm run dev
— open http://localhost:5173, the text should be rednpm run build
— open http://localhost:4173, the text should be red, but is blackSystem Info
Used Package Manager
npm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: