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

image base64 build error #1409

Closed
3 tasks done
xywai1993 opened this issue Jan 7, 2021 · 0 comments · Fixed by #1412
Closed
3 tasks done

image base64 build error #1409

xywai1993 opened this issue Jan 7, 2021 · 0 comments · Fixed by #1412

Comments

@xywai1993
Copy link

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

in my app.vue

<style >
body {
    background: url('/src/assets/menu-icon.png') left top no-repeat;
}
</style>

then, run vite build , The compiled file is as follows ,

body{background:url('"data:image/png;base64,iVBORw0KGgoAAAA......."') left top no-repeat};

Url like this url(' "data:image/png;base64,..........." ') , Quotation marks are redundant. It can't work , looks like this in the browser.

https://image.xxx.com/assets/%22data:image/png;base64,iVBORw0KGgoAAAANSUh......

so, i remove quotation,like this 。

<style>
body {
    background: url(/src/assets/menu-icon.png) left top no-repeat;
}
</style>

rebuild ,Then it's OK

body{background:url(data:image/png;base64,iVBORw0KGgoAAAA.......) left top no-repeat};

I'm not sure if this is a bug, or I can only write this。

Reproduction

Please provide a link to a repo that can reproduce the problem you ran into.

A reproduction is required unless you are absolutely sure that the the problem is obvious and the information you provided is enough for us to understand what the problem is. If a report has only vague description (e.g. just a generic error message) and has no reproduction, it will be closed immediately.

System Info

  • vite version: 2.0.0-beta.10
  • Operating System: MacOs Big Sur
  • Node version: v12.14.0
  • Package manager (npm/yarn/pnpm) and version: 6.14.9

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.
underfin added a commit to rolldown/vite that referenced this issue Jan 7, 2021
@santicros santicros mentioned this issue Jan 7, 2021
3 tasks
yyx990803 pushed a commit that referenced this issue Jan 7, 2021
fix(build/css): fix base64 inlined css urls with quotes

fix #1409, fix #1413
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
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