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

srcset with base64 value is mangled on build #15419

Closed
7 tasks done
elringus opened this issue Dec 24, 2023 · 1 comment · Fixed by #15422
Closed
7 tasks done

srcset with base64 value is mangled on build #15419

elringus opened this issue Dec 24, 2023 · 1 comment · Fixed by #15422

Comments

@elringus
Copy link

elringus commented Dec 24, 2023

Describe the bug

Consider following html:

<img srcset="data:image/avif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC" />

When built with Vite (in both dev and build, w/o any plugins or JS, just static HTML build), output html is:

<img srcset="data:image/avif;base64 , iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC " />

Notice added spaces around comma and at the end of the srcset value.

Reproduction

https://stackblitz.com/edit/vitejs-vite-yvgacv?file=index.html

Steps to reproduce

  1. Open the repro on stackblitz, it'll automatically run vite dev
  2. Notice the image is not rendered due to malformed srcset value
  3. Exit vite dev and run npx serve
  4. Notice the image is rendered correctly

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 Intel(R) Core(TM) i7-6900K CPU @ 3.20GHz
    Memory: 48.15 GB / 63.92 GB
  Binaries:
    Node: 21.4.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.6.6 - C:\Program Files\nodejs\npm.CMD
    pnpm: 7.29.3 - C:\ProgramData\chocolatey\bin\pnpm.EXE
  Browsers:
    Chrome: 120.0.6099.111
    Edge: Chromium (120.0.2210.91)

Used Package Manager

npm

Logs

No response

Validations

Copy link

stackblitz bot commented Dec 24, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant