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

Asset encoding in the data URI (Static Asset Handling) does not correctly indicate the type and cannot be disabled (assetsInlineLimit) #417

Open
8 of 9 tasks
albertochigua opened this issue Jun 15, 2024 · 1 comment

Comments

@albertochigua
Copy link

Related plugins

Describe the bug

I'm trying to configure the svg favicon of an application, and that's where I realized that vitejs converts files less than the set assetsInlineLimit bytes to URI data in base64, I ran into 2 situations:

  1. With Static Asset Handling activated, the encoding of the .svg file to data URI is transformed from 'image/svg+xml' to 'image/png', replacing 'png' with 'svg+xml' manually everything worked fine.

Screenshot from 2024-06-15 00-03-58
Screenshot from 2024-06-15 00-04-13

Unable to find a solution or explanation to this, try disabling Static Asset Handling with assetsInlineLimit set to 0 as the documentation dictates (https://vitejs.dev/config/build-options#build-assetsinlinelimit)

  1. The build was still encoding the import, no matter what value you set assetsInlineLimit to.

Screenshot from 2024-06-15 00-09-40
Screenshot from 2024-06-15 00-10-26

Reproduction

https://stackblitz.com/edit/nuxt-starter-myrddp?file=app.vue

Steps to reproduce

No response

System Info

System:
    OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (4) x64 Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
    Memory: 7.71 GB / 15.35 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
  Browsers:
    Chrome: 125.0.6422.141

Used Package Manager

npm

Logs

No response

Validations

@edison1105
Copy link
Member

I can't reproduce it with your reproduction and this is not a vite-plugin-vue problem either. It should be a vite problem and maybe it has been fixed.

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

No branches or pull requests

2 participants