vite icon indicating copy to clipboard operation
vite copied to clipboard

Non deterministic build with `cssCodeSplit = false` and css imports

Open susnux opened this issue 9 months ago • 1 comments

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.

  1. run npx vite build
  2. 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

susnux avatar May 03 '24 00:05 susnux