From 139e6d06ce897ec6537cb5ff147752be8047ac66 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Wed, 3 Jul 2024 15:43:14 -0700 Subject: [PATCH] More PWA --- web/public/serviceWorker.js | 6 ++---- web/vite.config.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) 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}"], }, }), ],