vite-svg-loader icon indicating copy to clipboard operation
vite-svg-loader copied to clipboard

Can we make `?component` configurable?

Open gkatsanos opened this issue 1 year ago • 1 comments

We were wondering if you'd accept a PR or had an idea if its possible to make ?component configurable? We're migrating away from https://github.com/nuxt-community/svg-module#vue-svg-loader which uses the ?inline url query option to do the same behavior and as other applications depend on the same component library we would like to try to keep it backwards compatible. We're happy to make the PR. (does this belong here or is this a behavior defined in https://github.com/svg/svgo ?

PS: I thought that using any other value besides raw or url will by default set behavior to be component but unfortunately that doesn't seem to be the case.

  vite: {
    plugins: [
      svgLoader({
        defaultImport: "component", // or 'raw'
      }),
    ],
  }

import PopupMenuAccountIcon from '@visable-dev/styleguide/dist/images/icons/account.svg ( component, works) import PopupMenuAccountIcon from '@visable-dev/styleguide/dist/images/icons/account.svg?inline' (doesn't work)

gkatsanos avatar Apr 25 '23 09:04 gkatsanos