jpkleemans / vite-svg-loader

Vite plugin to load SVG files as Vue components
MIT License
585 stars 61 forks source link

Match cached files #4

Closed FelixLuciano closed 3 years ago

FelixLuciano commented 3 years ago

The plug-in doesn't handle module files because Vite was pushing parameters in the file id for caching.

import icon from "@module/svg/icon.svg" //-> "@module/svg/icon.svg?v=f02481eb"
FelixLuciano commented 3 years ago

I also had some issues pointing to the module so i get around this by using @rollup/plugin-alias:

vite.config.js

import alias from "@rollup/plugin-alias"

export default {
  plugins: [
    alias({
      entries: [
        { find: "module", replacement: "path/to/module" }
      ]
    })
  ]
}
jpkleemans commented 3 years ago

Hi! Thanks for your PR.

FelixLuciano commented 3 years ago

Merge? 👀

jpkleemans commented 3 years ago

Thanks for your work!