pwa-module
pwa-module copied to clipboard
Is there any way to disable precaching entirely?
I am noticing that the module will assign a precache of our app's /login page, because the homepage '/' is behind an authorization wall (using auth-module).
So what happens is that the workbox precache storage tries to load the /login page instead of the homepage '/' and it throws a 500 error.
If I delete the precache file from Cache Storage in the Chrome inspector, everything works fine.
I really just want to be able to prevent the pwa-module from precaching anything, but
pwa: {
workbox: {
preCaching: false,
},
},
does not work. Is there any other option other than completely disabling the module?
Lines 75-78 in particular are what I want to disable: https://github.com/nuxt-community/pwa-module/blob/79322c18a28456a02ef0c3c596dff6cd88389f59/src/workbox/options.ts
// Add start_url to precaching
if (pwa.manifest && pwa.manifest.start_url) {
options.preCaching.unshift(...normalizePreCaching(pwa.manifest.start_url))
}
My workaround to get precaching to not occur was to simply remove start_url entirely in my manifest by explicitly setting to an empty string. Not '/', not removing the line from the manifest, but just '':
start_url: ''
That prevented precaching, but the service worker still functions.
Having the same issue with the latest PWA and Auth modules. Since I'm using a custom manifest I fixed it by removing 'start_url' line.