Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vue.js

workbox

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?

like image 961
Stephen Avatar asked Feb 03 '26 09:02

Stephen


1 Answers

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.

like image 81
Stephen Avatar answered Feb 04 '26 23:02

Stephen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!