Skip to content

tony19-sandbox/vue-srcset-relative-urls-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo Vue bug where relative srcset URLs are not transformed

It looks like @vue/compiler-sfc has a bug, introduced in v3.0.0-beta.9 when adding support for absolute URLs in srcset. This bug bypasses the transformation that would've resolved the asset URLs in srcset.

Steps to reproduce:

  1. In an SFC template, add an <img> tag with a srcset attribute, containing relative URLs with path aliases.
<img srcset="@/assets/300.png 2x, @/assets/150.png 1x">
  1. Start the dev server with yarn dev.

  2. Observe no image is shown in the browser, and that the <img>.srcset URLs are unresolved.

<!-- expected -->
<img srcset="/src/assets/300.png 2x, /src/assets/150.png 1x">

<!-- actual -->
<img srcset="/src/@/assets/300.png 2x, /src/@/assets/150.png 1x">

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published