Open jfernandezpe opened 1 year ago
Hey @jfernandezpe Feel free to open a PR to resolve this 👍 Looking forward to seeing your improvements 🙂
A possible workaround could be by playing with alias
. Config example:
import { join } from 'path';
import { defineNuxtConfig } from 'nuxt/config';
export default defineNuxtConfig({
srcDir: 'src/',
modules: ['@nuxtjs/svg-sprite'],
svgSprite: {
input: '~/src/assets/sprite/svg',
output: '~/src/assets/sprite/gen'
},
alias: {
'~/src/assets/sprite/gen': join(__dirname, 'src/assets/sprite/gen'),
}
});
up for the fix!
Hi,
I use svg-sprite-module in a couple of Nuxt 2 apps in a monorepo andboth apps share the same svgs so with
svgSprite.input
option I point to the asset package and it works.Now I'm creating a new Nuxt 3 app in the monorepo and it seems that the same strategy doesn't work, the icons do not load in the nuxt 3 app. After some debugging, I found that svg-sprite-module uses nitro's storage layer to deal with the filesystem. And because I'm pointing to a folder outside nitro's scope, svgSprite cannot the shared SVGs.
Am I doing something wrong? May you suggest any workaround? I would be happy to write a fix to this issue and send you a pull request but I'm not sure where to start.
I create a basic reproduction scenario, without configuring lerna or yarn workspaces: https://github.com/jfernandezpe/svg-sprite-module-error-reproduction
Thank you for your time!