From 0df5162981aa6f966bf1961d2ce495e6840ffca2 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Mon, 29 Jul 2024 01:00:39 -0400 Subject: Fix service worker caching index.html causing blank page --- vite.config.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vite.config.js b/vite.config.js index 5af4b6f..f8e9fde 100644 --- a/vite.config.js +++ b/vite.config.js @@ -14,7 +14,10 @@ export default defineConfig({ 'safari-pinned-tab.svg', 'mstile-150x150.png', ], - injectManifest: true, + injectManifest: { + globPatterns: ['**/*.{js,css,html,png,svg}'], + globIgnores: ['index.html'], + }, manifest: { name: 'Donetick: Simplify Tasks & Chores, Together.', short_name: 'Donetick', @@ -55,6 +58,10 @@ export default defineConfig({ background_color: '#ffffff', display: 'standalone', }, + workbox: { + skipWaiting: true, // Force the waiting service worker to become the active service worker + clientsClaim: true, // Take control of uncontrolled clients as soon as the service worker becomes active + }, }), ], -- cgit