Answer the question
In order to leave comments, you need to log in
Why is the cache not being flushed in the service worker CRA?
Is anyone using CRA 3.0.0 + service workers?
I use CRA 3.1.1 and service workers.
I register like this:
worker.register({
onUpdate: registration => {
const waitingServiceWorker = registration.waiting;
if (waitingServiceWorker) {
waitingServiceWorker.addEventListener('statechange', event => {
if (event.target.state === 'activated') {
window.location.reload();
}
});
waitingServiceWorker.postMessage({ type: 'SKIP_WAITING' });
}
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question