vite
vite copied to clipboard
Non deterministic build with `cssCodeSplit = false` and css imports
Describe the bug
If I set cssCodeSplit
to false
and have css files imported this leads to empty chunks named like style-xyz
, but the name is changing on every vite build without changed source.
Due to the changed name all files that imported that style are now also changing (as the import name changes, the content is different thus the hash is different, causing the file to rename).
Reproduction
https://stackblitz.com/edit/vitejs-vite-kkmede
Steps to reproduce
I could currently not reproduce the non-deterministic behavior (my setup is much more complex with plugins), but on the reproduction you can see an empty chunk is emitted for the style import.
- run npx vite build
- see empty chunk that contained the styles once
System Info
System:
OS: Linux 6.8 openSUSE Tumbleweed 20240429
CPU: (12) x64 AMD Ryzen 5 5500U with Radeon Graphics
Memory: 3.93 GB / 14.98 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.12.1 - /usr/bin/node
Yarn: 1.22.21 - /usr/bin/yarn
npm: 10.5.0 - /usr/bin/npm
Browsers:
Chromium: 122.0.6261.128
npmPackages:
vite: ^5.2.11 => 5.2.11
Used Package Manager
npm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.