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

Fix path resolution #282

Open obulat opened 1 year ago

obulat commented 1 year ago

Might fix #281

Description

In our app, we use src directory inside the root. We use svg-sprite-module with Nuxt 2, and all the paths work correctly. However, trying to migrate to Nuxt 3 causes the paths to fail. I tried replacing the path values in nitro:init hook with the ones that are resolved at the start of the setup function (inputDir and outDir). It seems to work with the setup where assets folder is under src folder, and the options for this module are set as

  svgSprite: {
    input: "~/assets/svg/raw",
    output: "~/assets/svg/sprite",
  },

I am not sure how to test this change.