I have a pwa that is intended for use in areas with poor connectivty. When I cache less than 100 pages/assets, the SW registers and the pages are cached and everything works.
When I exceed the 100 pages/assets the SW fails to register. (Close on 2000 pages)
The total file sizes that I am trying to cache is 20mb, so it is not a disk space issue.
None of the literature that I find indicated that there is an asset limit as such.
Is there a page limit?
Here is my working code:
const app_version = '2';
const staticCacheName = 'site-static-v2';
const dynamicCacheName = 'site-dynamic-v1';
const assets = [
'/',
'/index.html',
'/library.html',
'/view_offline.html',
'/player.html',
'/json.js',
'/content.js',
'/js/app.js',
'/js/ui.js',
'/js/materialize.min.js',
'/css/styles.css',
'/css/h5p.css',
'/css/materialize.min.css',
'/img/dish.png',
'https://fonts.googleapis.com/icon?family=Material+Icons',
'https://fonts.gstatic.com/s/materialicons/v47/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2',
'/pages/fallback.html',
//HERE IS WHERE I WANT TO ADD THE OTHER 1990 odd pages in the same method
];
// install event
self.addEventListener('install', evt => {
console.log('service worker installed');
evt.waitUntil(
caches.open(staticCacheName).then((cache) => {
console.log('caching shell assets');
cache.addAll(assets);
})
);
});