static assets in CSS url() without opening slash is not resolved or bundled #9800
Closed
7 tasks done
Labels
inconsistency
Inconsistency between dev & build
p2-nice-to-have
Not breaking anything but nice to have (priority)
Describe the bug
Static assets in CSS url() without opening slash
/
is not resolved or bundled withvite build
.For example,
background-image: url('src/assets/sample.svg')
will remain as is, without any file copied or path changed.But
background-image: url('/src/assets/sample.svg')
will work correctly, with path changed tourl('/assets/sample.svg')
and file copied.Both of the above are working correctly in
dev
mode.I'm not sure if it's my problem or my responsibility to ensure the opening slash exists, but I can't find any related info in the doc or here. Sorry if I just missed something.
Reproduction
https://stackblitz.com/edit/vitejs-vite-2j2snf?file=src/App.css
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: