We have a Vue component library where we use Vite to compile Vue components, but also compile svg files as Vue components using vite-svg-loader. After bumping our vite version from 5.1.7 to 5.2.12, our svg icons were not compiled anymore. No error in the console. We also have build.sourcemap set to true and the sourcemap files for the svg icons are generated, but not the actual js files.
I tried to log the code from the load hook of vite-svg-loader and the code is indeed logged. I created a custom plugin in the reproduction repository that show the logs. I also tried to modify the plugin to simply return export default { template: MY_SVG_CODE } instead of using vue/compiler-sfc, but no difference.
Click to expand!
```shell
yarn run v1.22.19
warning package.json: No license field
$ vite build
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
vite v5.2.12 building for production...
{
filePath: '/home/projects/vue3-vite-starter-sbiilv/src/icons/IconGlobe.svg'
}
✓ 4 modules transformed.
dist/style.css 0.04 kB │ gzip: 0.06 kB
dist/components/HelloWorld.vue.mjs 1.80 kB │ gzip: 0.82 kB │ map: 1.05 kB
✓ built in 141ms
✨ Done in 2.35s.
```
[X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
We have a Vue component library where we use Vite to compile Vue components, but also compile svg files as Vue components using vite-svg-loader. After bumping our
vite
version from 5.1.7 to 5.2.12, our svg icons were not compiled anymore. No error in the console. We also havebuild.sourcemap
set to true and the sourcemap files for the svg icons are generated, but not the actual js files.I tried to log the code from the
load
hook ofvite-svg-loader
and the code is indeed logged. I created a custom plugin in the reproduction repository that show the logs. I also tried to modify the plugin to simply returnexport default { template: MY_SVG_CODE }
instead of usingvue/compiler-sfc
, but no difference.Reproduction
https://stackblitz.com/edit/vue3-vite-starter-sbiilv?file=package.json&view=editor
Steps to reproduce
yarn build
as start command.mjs
file for the HelloWorld component, but the sourcemap for both the component and icon"vite": "5.1.7",
instead of5.2.12
yarn
thenyarn why vite
to be sure you're now on5.1.7
yarn build
again.mjs
and.mjs.map
files for both the component and svg iconSystem Info
Used Package Manager
yarn
Logs
Click to expand!
```shell yarn run v1.22.19 warning package.json: No license field $ vite build The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details. vite v5.2.12 building for production... { filePath: '/home/projects/vue3-vite-starter-sbiilv/src/icons/IconGlobe.svg' } ✓ 4 modules transformed. dist/style.css 0.04 kB │ gzip: 0.06 kB dist/components/HelloWorld.vue.mjs 1.80 kB │ gzip: 0.82 kB │ map: 1.05 kB ✓ built in 141ms ✨ Done in 2.35s. ```Validations