vite-plugin-vue icon indicating copy to clipboard operation
vite-plugin-vue copied to clipboard

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

Open albertochigua opened this issue 1 year ago • 1 comments

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

albertochigua avatar Jun 15 '24 06:06 albertochigua

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.

edison1105 avatar Sep 23 '24 06:09 edison1105

Closing as the reproduction does not exist.

sapphi-red avatar Apr 26 '25 17:04 sapphi-red