From b9fdd973301381d0cb231886ed7b476c3caaf532 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Wed, 29 Jul 2026 17:28:35 +0000 Subject: [PATCH] Add PWA manifest support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Icons already existed in public/icons/ but nothing wired them up — no manifest, no service worker, not installable. --- frontend/package.json | 3 ++- frontend/vite.config.ts | 26 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 07e3992..0720453 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -25,6 +25,7 @@ "@types/react-plotly.js": "^2.6.4", "@vitejs/plugin-react": "^4.2.1", "typescript": "^5.4.5", - "vite": "^5.2.11" + "vite": "^5.2.11", + "vite-plugin-pwa": "^1.3.0" } } diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 5c5c638..67a4f28 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,7 +1,31 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' +import { VitePWA } from 'vite-plugin-pwa' export default defineConfig({ base: '/forecasting/', - plugins: [react()], + plugins: [ + react(), + VitePWA({ + registerType: 'autoUpdate', + manifest: { + name: 'Forecasting', + short_name: 'Forecasting', + start_url: '/forecasting/', + scope: '/forecasting/', + display: 'standalone', + theme_color: '#0077b6', + background_color: '#0077b6', + icons: [ + { src: '/forecasting/icons/icon-192.png', sizes: '192x192', type: 'image/png' }, + { src: '/forecasting/icons/icon-512.png', sizes: '512x512', type: 'image/png' }, + ], + }, + workbox: { + navigateFallback: '/forecasting/index.html', + navigateFallbackDenylist: [/\/api\//], + globPatterns: ['**/*.{js,css,html,ico,png,svg}'], + }, + }), + ], })