nuxt-modules / svg-sprite

Optimize SVG files and combine them into sprite
https://codesandbox.io/s/github/nuxt-community/svg-sprite-module/
MIT License
295 stars 41 forks source link

[Bug] Input/Ouput properties are not respected #295

Open ivandimovd opened 10 months ago

ivandimovd commented 10 months ago

In a new Nuxt 3 project, I integrated the module. During build time, it generates icons under root/assets/sprite/etc..., but at runtime, it expects them in root/src/assets. It's seems to be working, when I generate the icons in root/assets/sprite/gen and then copy them to root/src/assets/sprite. I saw that it is generating a wrong path in .nuxt/svg-sprite.mjs

As a temporary solution, I'm using an alias.

AndriiGera commented 10 months ago

Having the same problem. While module's setup hook does care about configured nuxt aliases, nitro:init hook responsible for generating and scanning icon directories ignores user alias configuration:

// module.ts:130
nuxt.hook("nitro:init", async (nitro) => {
      const input = options.input.replace(/~|\.\//, "root").replace(/\//g, ":");
      const output = options.output.replace(/~\/|\.\//, "");
wunschpunsh commented 10 months ago

@ivandimovd hello. Can you show example how you using your alias? Thank you.