Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to disable svg caching #160

Open
blasdfaa opened this issue May 11, 2024 · 6 comments
Open

how to disable svg caching #160

blasdfaa opened this issue May 11, 2024 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@blasdfaa
Copy link

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

Copy link
Member

atinux commented May 22, 2024

Why not creating a .vue component and use the SVG inside for such a specific use case?

@atinux atinux added the question Further information is requested label May 22, 2024 — with Volta.net
@gigor
Copy link

gigor commented Dec 12, 2024

Also need this. Cache is super annoying during development.

@antfu antfu self-assigned this Dec 12, 2024
@antfu
Copy link
Member

antfu commented Dec 18, 2024

This wasn't about caching, I think; it's more like it wasn't picking up the updates for custom collections. #282 should already fixed this.

@antfu antfu closed this as completed Dec 18, 2024
@gigor
Copy link

gigor commented Dec 18, 2024

@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
            }
        ]
    }

@antfu antfu reopened this Dec 18, 2024
@antfu
Copy link
Member

antfu commented Dec 20, 2024

c695667 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.

@antfu antfu closed this as completed Dec 20, 2024
@gigor
Copy link

gigor commented Dec 20, 2024

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

@antfu antfu reopened this Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants