vitejs / vite

Next generation frontend tooling. It's fast!
http://vitejs.dev
MIT License
66.85k stars 6k forks source link

[3.2.0-beta.3] `new URL` doesn't work with alias and dynamic path #10597

Open jacekkarczmarczyk opened 1 year ago

jacekkarczmarczyk commented 1 year ago

Describe the bug

The code below doesn't return asset URL

new URL(`@/${img}.svg`, import.meta.url).href

Alias alone works, dynamic path works, but these 2 together don't: image

Reproduction

https://stackblitz.com/edit/vitejs-vite-ecxnab?file=main.js&terminal=dev

Steps to reproduce

Open the repro, see the one image is not loaded while others are

System Info

stackblitz

Used Package Manager

npm

Logs

No response

Validations

usercao commented 1 year ago

This issue still exists in version 4.3.2.

BenHerbst commented 1 year ago

Yup, also had this today and cant find a way to fix

FarooqAlaulddin commented 1 year ago

issue persists.

AndresGarciadelaHuerta commented 1 year ago

Any updates on this issue? I've been stuck with this problem while trying to migrate from webpacker to vite 😕

kevingjs commented 2 months ago

Any update on this? Issue still persist.