Search code examples
vue.jsworkbox

workbox.core.skipWaiting is not a function (but workbox.skipWaiting is)


I am developing a pwa (vue app with quasar), and I am really confused, because including options as indicated results in a directive inside my service worker workbox.core.skipWaiting() which causes the service worker registration to fail and the following error in the browser console:

Uncaught TypeError: workbox.core.skipWaiting is not a function

If on the other hand I create a custom sw file with the directive renamed to workbox.skipWaiting() it works fine and the browser console reports no errors.

Looking around on the web I have seen both forms referred to, and I can find no reason why this results in an error. I should also note that a separate directive in my same sw file using core works just fine and causes no errors:

workbox.core.setCacheNameDetails({prefix: "myapp-assets"});

Any idea why this might be failing?


Solution

  • After a ton of research, it seems that the main package responsible for embedding workbox was somehow corrupted on update. So instead of pointing to 4.3.1 version of workbox script, it was still pointing to 3.6.3, and I am assuming that core style of directive was non functional in that older version. Replacing the corrupt package, (and updating to 4.3.1) seems to have solved it.