vite-plugin-pwa icon indicating copy to clipboard operation
vite-plugin-pwa copied to clipboard

Preload response

Open mastercoms opened this issue 3 years ago • 6 comments

I get this error in console and in network, I see that a Preload request was canceled to my app shell page.

The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle.

What sort of thing is this caused by?

mastercoms avatar Jun 11 '22 13:06 mastercoms

@mastercoms you should ask/check these questions on workbox repo: https://github.com/GoogleChrome/workbox/issues/2178

userquin avatar Jun 11 '22 16:06 userquin

I'm having a hard time transferring this issue to what I have in my VitePWA config. I mean, is there any config this is related to? globPatterns? manifest entries?

mastercoms avatar Jun 11 '22 17:06 mastercoms

I'm not using a custom sw.js, just the one generated by this plugin, which is why I ask.

mastercoms avatar Jun 11 '22 17:06 mastercoms

@mastercoms I need some repro or your pwa plugin configuration: it seems you've a navigation preload and maybe blacklist entry configured

You can try to add sourcemap, don't minify the build then take a look the sw generated by workbox, check the linked issue if it is the same problem, it can be a bug on workbox

userquin avatar Jun 11 '22 17:06 userquin

https://github.com/mastercomfig/comfig-app/blob/develop/astro.config.mjs

mastercoms avatar Jun 17 '22 23:06 mastercoms

@mastercoms is this a copy of my PR on astro (I need to change a few things)?

Anyway, the problem can be related to https://github.com/antfu/vite-plugin-pwa/pull/306, since the workbox generatedSW call doesn't include the claims stuff, check this entry on îles to solve it: https://github.com/ElMassimo/iles/blob/main/packages/pwa/src/pwa.ts#L37

EDIT: just include both entries on the pwa configuration under workbox entry (you need to add it):

workbox: {
  clientsClaim: true,
  skipWaiting: true,
}

userquin avatar Jun 18 '22 07:06 userquin