-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- 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.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.