damianstasik / vite-svg

Use SVG files as Vue components with Vite
MIT License
105 stars 14 forks source link

Can the plugin use default export? #10

Open uniquejava opened 4 years ago

uniquejava commented 4 years ago

Thank you for this plugin.

I find the usage for this plugin is a little verbose.

Can we simply do this

import SkipIcon from '/@assets/skip_next-24px.svg';

instead of

import  {VueComponet as SkipIcon} from '/@assets/skip_next-24px.svg';

I see an equivalent react plugin here: https://developer.aliyun.com/mirror/npm/package/vite-plugin-svg-react

I just thought their usage is more concise.

uniquejava commented 4 years ago

Ah, I just learned your example project, I see why.

damianstasik commented 3 years ago

Yes, I wanted to keep the default behavior, but I could check whether making it an option would be something feasible.

richardtallent commented 3 years ago

I'm still fairly new to using ES module imports, is there a benefit I'm not aware of for having the export named rather than using default (when there's only one class being exported). Or is retaining the VueComponent name a concern of backward compatibility?