diff --git a/web/public/serviceWorker.js b/web/public/serviceWorker.js index 6a4ceca..edfb57a 100644 --- a/web/public/serviceWorker.js +++ b/web/public/serviceWorker.js @@ -3,7 +3,7 @@ console.log("Loading serviceWorker.js..."); import { precacheAndRoute } from "workbox-precaching"; -import { registerRoute } from "workbox-routing"; +import { registerRoute, NavigationRoute } from "workbox-routing"; import { NetworkFirst } from "workbox-strategies"; import { ExpirationPlugin } from "workbox-expiration"; @@ -18,9 +18,7 @@ self.skipWaiting(); precacheAndRoute(self.__WB_MANIFEST); // Works if app is a single page app -// workbox.routing.registerRoute( -// new workbox.routing.NavigationRoute(workbox.precaching.createHandlerBoundToURL('/index.html')) -// ); +registerRoute(new NavigationRoute(workbox.precaching.createHandlerBoundToURL("/index.html"))); // Example cache GET req (import removed) // workbox.routing.registerRoute(({ url }) => { diff --git a/web/vite.config.js b/web/vite.config.js index 1b12b1b..cefe53b 100644 --- a/web/vite.config.js +++ b/web/vite.config.js @@ -21,7 +21,7 @@ export default defineConfig({ srcDir: "public", filename: "serviceWorker.js", injectManifest: { - globPatterns: ["**/*.{js,css,html,svg,ico,woff,json}"], + globPatterns: ["**/*.{js,css,html,svg,ico,woff,woff2,json,png,ttf}"], }, }), ],