Skip to content

Commit

Permalink
More PWA
Browse files Browse the repository at this point in the history
  • Loading branch information
datajohnson committed Jul 3, 2024
1 parent 68c4213 commit 139e6d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions web/public/serviceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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 }) => {
Expand Down
2 changes: 1 addition & 1 deletion web/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}"],
},
}),
],
Expand Down

0 comments on commit 139e6d0

Please sign in to comment.