damianstasik/vite-svg

Use default export for VueComponent

antfu opened this issue · 0 comments

antfu commented

As Vue assumes components are imported via the default exports, it can integrate better with other plugins/processors/transformers to collaborated together.

Related to
unplugin/unplugin-vue-components#9
unplugin/unplugin-vue-components#12
#10

And might be able to solve #5 along the way

Proprosed solution

Add and query, something like ?vue, to specify it's imported as Vue component explicitly.

import { VueComponent as MyIcon } from './svgs/my-icon.svg';
import MyIcon from './svgs/my-icon.svg?vue';

Or the other way around, make the importing default to Vue

import MyIcon from './svgs/my-icon.svg';
import SvgUrl from './svgs/my-icon.svg?url';

Wondering what do you think?