Workbox and lighthouse should I be pre-caching all my images?

397 Views Asked by At

I'm trying to improve my lighthouse score which is very poor at 30 despite the site feeling like it loads very fast with an empty cache.

I believe this is because the default PWA setup for a Vue app with Workbox is to precache absolutely everything in the src/ folder, and therefore downloads a lot of assets in the background during first load:

enter image description here

You'll notice the largest chunk of time is idle time which I believe is downloading all the service worker precache files. I feel like lighthouse is counting this as loading time against me despite the site being usable while this is happening.

Is it normal practice to include all of the websites images? Ideally I'd like to exclude all images except ones inside of a src/assets/images/cached/ folder, but during a Vue build these all get placed into a single dist/img folder so I can't exclude based on directory url.

0

There are 0 best solutions below