Releases: damianstasik/vite-svg
v0.7.0
A small fix for an error during build caused by some internal changes in Vite, now vite-plugin-svg
should work fine with the latest Vite version (1.0.0-rc.4
).
Thank you @RegisFrey for reporting the issue!
v0.6.0
This release fixes the error when trying to import an SVG file from node_modules
or some aliased path.
v0.5.0
Nothing new unfortunately, just a compatibility update to use the new transform API signature (instead of multiple variables, a single object is now provided).
Vite is now at 1.0.0-beta!!
v0.4.0
Important note
This is a release with a breaking change, please read the notes below to understand how to migrate from [email protected]+
.
New way of importing SVGs as Vue components
Before v0.4.0
you would add ?component
query string at the end of the file path to import an SVG file. This caused a few issues with Rollup and Jest, as they do not support (yet?) query strings in the file paths. Starting from v0.4.0
you will have access to both SVG file URL and Vue component using a single import statement:
import myIconUrl, { VueComponent as MyIcon } from './svgs/icon.svg';
console.log(myIconUrl); // `/src/svgs/icon.svg`
console.log(MyIcon); // SVG as Vue component
In the example above you can see that there are two things exported by ./svgs/icon.svg
:
- Default export which returns URL to the file (handled by Vite)
- Named export called
VueComponent
which returns the SVG file converted to a Vue component (handled byvite-plugin-svg
)
Due credit: VueComponent
name is inspired by @svgr/webpack
(which uses ReactComponent
).
Installing @vue/compiler-dom
is no longer needed
vite-plugin-svg
will now use @vue/compiler-sfc
which you should already have installed as a devDependency
in pair with vite
.
v0.3.0
It's been a while! A lot has changed in Vite since [email protected]
, most notably we now have a plugin system and ability to add custom transforms!
v0.2.0
Support Vite v0.13.0
which required a tiny modification to the Koa middleware (getDevSvgPlugin
) as there was a slight change of the way static assets are handled, fortunately nothing that would break this plugin for good 💪
v0.1.1
First release that supports Vite v0.12.0