icon
icon copied to clipboard
how to disable svg caching
How can I disable icon caching? I'm doing svg animation and I need hmr when changing an svg file.
https://stackblitz.com/edit/nuxt-icon-playground-mjfbfn?file=assets%2Ficons%2Fnuxt-icon.svg Try changing the fill attribute of the svg file and save it
Why not creating a .vue component and use the SVG inside for such a specific use case?
Also need this. Cache is super annoying during development.
This wasn't about caching, I think; it's more like it wasn't picking up the updates for custom collections. https://github.com/nuxt/icon/pull/282 should already fixed this.
@antfu thanks for looking at it. Still have this behavior with local svgs on 1.10.2. Refreshing page does not help, neither does restarting nuxt, the only thing that makes svg change to be shown is rm -rf .nuxt/cache/nuxt/icon
The config looks like this:
icon: {
provider: 'server',
mode: 'svg',
customCollections: [
{
prefix: 'local',
dir: './assets/icons',
normalizeIconName: false
}
]
}
c6956675c61fe669bfa1311c6db56bf036fc603b should fix it. Tho it's a bit tricky to support real HMR as the rendered icons do not have a direct relationship with the source, but in 1.10.3 at least it make client refresh work without restarting the server.
Still does not work. The json file in .nuxt/cache/nuxt/icon does not get updated neither on svg file change nor on server restart.
Here is stackbiz reproduction https://stackblitz.com/edit/nuxt-icon-3trsfvly?file=assets%2Ficons%2Fnuxt-icon.svg
There is also a new error on nuxt dev:
ERROR [uncaughtException] t._onTimeout is not a function