Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative URLs in srcset are not transformed #4819

Closed
tony19 opened this issue Oct 20, 2021 · 0 comments
Closed

Relative URLs in srcset are not transformed #4819

tony19 opened this issue Oct 20, 2021 · 0 comments
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working

Comments

@tony19
Copy link
Contributor

tony19 commented Oct 20, 2021

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.

Version

3.2.20

Reproduction link

https://github.com/tony19-sandbox/vue-srcset-relative-urls-bug

Steps to reproduce

  1. In a template, add an <img> with a srcset that contains 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.

What is expected?

  • The srcset URLs are resolved:
<img srcset="/src/assets/300.png 2x, /src/assets/150.png 1x">
  • The image appears in the browser.

What is actually happening?

  • The srcset URLs are unresolved:
<img srcset="/src/@/assets/300.png 2x, /src/@/assets/150.png 1x">
             ^^^^^^^^^^^^^^^^^^^^^     ^^^^^^^^^^^^^^^^^^^^^
  • The image is not shown.
@ygj6 ygj6 added 🐞 bug Something isn't working 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Oct 20, 2021
iwusong pushed a commit to iwusong/core that referenced this issue May 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working
Projects
None yet
2 participants