nuxt / icon

The <Icon> component, supporting Iconify, Emojis and custom components.
https://stackblitz.com/edit/nuxt-icon-playground?file=app.vue
MIT License
868 stars 37 forks source link

[Feature Request] Option to disable cache (localStorage) #88

Open renegadevi opened 1 year ago

renegadevi commented 1 year ago

Iconify by default has cache enabled, this is good for performance but because it uses localStorage, it's something that may not always be initially wanted. As for Iconify, it creates more entries the more icons you use.

Skärmavbild 2023-06-24 kl  18 18 42

Iconify has a built-in function to disable this, but I cannot find any way to disable it with this module, such as in module options in the nuxtIcon-config which would had been very useful. https://iconify.design/docs/iconify-icon/disable-cache.html

By default, localStorage is enabled, sessionStorage is disabled.

Atinux commented 1 year ago

Do you want to disable it in development only @renegadevi ?

Because it production this can lead to serious performance drawbacks.

renegadevi commented 1 year ago

Do you want to disable it in development only @renegadevi ?

Yes this is mainly during development or testing.

Atinux commented 11 months ago

Have you try adding a plugin to do it @renegadevi

// plugins/iconify.ts
import { disableCache } from 'iconify-icon';

export default defineNuxtPlugin(() => {
  if (process.dev) {
    disableCache('all')
  }
})
renegadevi commented 11 months ago

Sadly not. I tried it with the nuxt-icons and just standalone iconify-icons, both still cached.