kevinmarrec / nuxt-pwa-module

⚠️ DEPRECATED ⚠️ Zero config PWA solution for Nuxt 3
MIT License
335 stars 32 forks source link

Lighthouse Indexeddb Warning #9

Closed ram-you closed 2 years ago

ram-you commented 2 years ago

Hi, how To Fix Lighthouse Indexeddb Warning : "There may be stored data affecting loading performance in this location: IndexedDB"

kevinmarrec commented 2 years ago

Hi @ram-you.

The full warning provided by Lighthouse is the following :

There may be stored data affecting loading performance in this location: IndexedDB. Audit this page in an incognito window those resources from affecting your scores.

Lighthouse is giving you a hint that you should run Lightouse in incognito mode to ensure the performance test isn't affected by any already created resource for this website.

Here are some options you have :

ram-you commented 2 years ago

Hi @kevinmarrec , thanks for response. I know how to work around this problem, but I was wondering why store the cache in indexedDB and is there an option not to.

kevinmarrec commented 2 years ago

@ram-you

If something is stored in IndexedDB, this is handled by Workbox.

I found some info here https://developers.google.com/web/ilt/pwa/live-data-in-the-service-worker

Then I inspected what was stored in IndexedDB :

image

It sounds like IndexedDB is used by the Workbox Expiration plugin, which is used by this module to add expiration on cached images :

https://github.com/kevinmarrec/nuxt-pwa-module/blob/b4873d95ee3e5d58f41078a09d6e95db244013e8/templates/workbox/sw.js#L46

See https://developer.chrome.com/docs/workbox/reference/workbox-expiration which indeed references IndexedDB.

It doesn't seem to be possible to opt out IndexedDB usage, as it's how the official Worbox Expiration plugin works.

kevinmarrec commented 2 years ago

@ram-you The only solution I can give you is the possibility to use your custom Workbox template and don't use expiration plugin, but I think it would be quite unreasonable to do this cause, after all, when you want to run a Lighthouse test you want to run it on a fresh website, without cookies, cache (IndexedDB included) and more. That's why I would just recommend you to always run your Lighthouse in incognito mode :)

kevinmarrec commented 2 years ago

Feel free to open a new issue if you want the custom template option as module enhancement.