Describe the bug
When modifying an asset referenced in a CSS file, a rebuild is triggered, but the asset included in the build is not the updated version.
So, for example, modifying an image included with url(...), will trigger a new build, but the image in the build is still the old one.
I have looked for an issue related to this bug, but haven't found any, which is odd since it's a very common use case. Maybe I'm using the wrong terms or doing something wrong.
Reproduction
https://stackblitz.com/edit/vitejs-vite-5jtq9ym7?file=src%2Faa.svg
Steps to reproduce
- Run
vite build --watch
- Modify
src/aa.svg (for example clear the contents) and save
Expected result:
A build is generated, aa-[hash].svg should get a new hash, and it's contents should be empty (0.00 kB)
Actual result:
A build is generated, but nothing has changed. aa-[hash].svg has the same hash as before, and it still is 1.00 kB
System Info
System:
OS: Linux 6.8 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
CPU: (4) x64 Intel(R) Core(TM) i5-3450 CPU @ 3.10GHz
Memory: 8.71 GB / 15.57 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
npmPackages:
vite: ^6.3.1 => 6.3.1
Used Package Manager
npm
Logs
No response
Validations
Describe the bug
When modifying an asset referenced in a CSS file, a rebuild is triggered, but the asset included in the build is not the updated version.
So, for example, modifying an image included with
url(...), will trigger a new build, but the image in the build is still the old one.I have looked for an issue related to this bug, but haven't found any, which is odd since it's a very common use case. Maybe I'm using the wrong terms or doing something wrong.
Reproduction
https://stackblitz.com/edit/vitejs-vite-5jtq9ym7?file=src%2Faa.svg
Steps to reproduce
vite build --watchsrc/aa.svg(for example clear the contents) and saveExpected result:
A build is generated,
aa-[hash].svgshould get a new hash, and it's contents should be empty (0.00 kB)Actual result:
A build is generated, but nothing has changed.
aa-[hash].svghas the same hash as before, and it still is 1.00 kBSystem Info
System: OS: Linux 6.8 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat) CPU: (4) x64 Intel(R) Core(TM) i5-3450 CPU @ 3.10GHz Memory: 8.71 GB / 15.57 GB Container: Yes Shell: 5.2.21 - /bin/bash Binaries: Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm npmPackages: vite: ^6.3.1 => 6.3.1Used Package Manager
npm
Logs
No response
Validations