Questions tagged [workbox-window]

16 questions
5
votes
1 answer

How to send a message from service worker to a Workbox class instance's "message" event?

I have this in my window.js... const wb = new Workbox('sw.js'); wb.messageSW({type:'START'}); wb.addEventListener('message', e=>{ console.log(e); }); ...in my sw.js, I have... self.addEventListener('message', (e)=>{ if (e.data) { …
JP _
  • 530
  • 4
  • 14
4
votes
1 answer

Inconsistent behaviour with workbox-window.update()

Platform "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" Workbox version 5.0.0-rc.0 I am using the workbox-window update() method to trigger a service worker update check as described in…
3
votes
1 answer

Enabling logging when using workbox-webpack-plugin

My project had an old partial implementation of a service worker using Workbox. I've been tyring to update it and add functionality along the way. Somewhere in this process I've lost the Workbox logs in the dev Console (Chrome Version…
2
votes
0 answers

How to offer a page reload when the service worker is updated after a page refresh?

I'm currently using the latest Workbox version 4.3.1 with workbox-window, I'm offering a page reload for users by listening to the waiting event, I'm using the code provided on the Advanced Recipes page of the Workbox documentation. The code on the…
Pierre
  • 12,468
  • 6
  • 44
  • 63
1
vote
0 answers

React PWA Workbox InvalidStateError

Few users on IOS devices get error InvalidStateError newestWorker is null. This is my register function using workbox-window just like the documentation mentioned if ('serviceWorker' in navigator) { const wb = new…
Oktay Yuzcan
  • 2,097
  • 1
  • 6
  • 15
1
vote
0 answers

workbox-window "bad-precaching-response" error and "redundant" service worker

Library Affected: workbox-window Browser & Platform: chromium-based browser Issue or Feature Request Description: I'm having this problem only when trying to implement workbox-window. If I remove the implementation, the errors disappear. My goal is…
1
vote
1 answer

Precached content does not load from cache

In my React SSR application I have implemented service worker(via Workbox). It's working fine. Every time when I am changing some piece of code, rebuilding again, running the server, going to the browser, I am seeing that my cache was updated…
1
vote
1 answer

Workbox precache doesn't precache

I'm attempting to implement workbox to precache image and video assets on a website. I've created a service worker file. It appears to be successfully referenced and used in my application. The service worker: import { clientsClaim,…
1
vote
1 answer

Workbox service worker Manual Update flow

this is my implementation in react spa of sw registration and refreshing. The problem is when I trigger manual update on current sw and accept new version (e.g. send post message SKIP WAITING event in active sw) and after new sw gets activated I…
1
vote
1 answer

Serviceworker never gets activated or receives messages but workbox functionality works on subpaths

In my current project using webpack with (workbox-webpack-plugin) and workbox (with workbox-window) I have encountered an error where the serviceworker will never respond to messages when the page is loaded at a "deep url", like…
1
vote
0 answers

How to make site available offline using Laravel Mix Workbox

I have a Laravel Vue PWA using Laravel Mix Workbox. In webpack.mix.js I have: mix .js('resources/js/app.js', 'public/js') .sass('resources/sass/app.scss', 'public/css') .generateSW({ additionalManifestEntries: [{url: 'index.php',…
Felix Eve
  • 3,811
  • 3
  • 40
  • 50
1
vote
1 answer

Workbox window failing to install service worker

I'm migrating form v3 to v4 , using workbox-window(CDN)and workbox-webpack-plugin in my vuejs app. It works fine locally with http-server, but after deploying, I get this error and it fails to install the service worker. print @…
0
votes
1 answer

How to dispatch event on Push receive using Workbox?

I have a VueJS component where I listen for pushMessageEvent :