I am using below code to purge workbox created cache but it also deletes the precache which is managed by workbox it selves.
Please let me know if better way exists.
// Clean up caches in activate event to ensure no pages are using the old caches.
self.addEventListener('activate', (event) => {
const promiseChain = caches.keys()
.then((cacheNames) => {
// Step through each cache name and delete it
return Promise.all(
cacheNames.map((cacheName) => caches.delete(cacheName))
);
});
// Keep the service worker alive until all caches are deleted.
event.waitUntil(promiseChain);
});