diff --git a/service-worker.js b/service-worker.js index e30306b5..42fed210 100644 --- a/service-worker.js +++ b/service-worker.js @@ -8,11 +8,12 @@ precacheAndRoute(self.__WB_MANIFEST); // } self.addEventListener("fetch", (event) => { - console.log("Fetch event triggered"); - - const fetchEvent = event; - const url = fetchEvent.request.url; - if (url.includes("oauth")) { - fetchEvent.respondWith(fetch(fetchEvent.request)); + const { request } = event; + const url = new URL(request.url); + console.log(request.mode); + console.log("path includes redirect:", url.pathname.includes("redirect")); + if (url.pathname.includes("redirect") || request.mode === "navigate") { + console.log("Fetch event triggered for redirect navigation"); + fetchEvent.respondWith(fetch(request)); } }); diff --git a/webpack.config.js b/webpack.config.js index cb02fa8f..45be9688 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -28,10 +28,10 @@ module.exports = { // that's why size is sincreased to 6mb maximumFileSizeToCacheInBytes: 6291456, - // cleanupOutdatedCaches: true, - // clientsClaim: true, - // sourcemap: false, - // skipWaiting: true, + cleanupOutdatedCaches: true, + clientsClaim: true, + sourcemap: false, + skipWaiting: true, swSrc: "/service-worker.js", swDest: "service-worker.js", }),