Add PWA manifest support

Icons already existed in public/icons/ but nothing wired them up —
no manifest, no service worker, not installable.
This commit is contained in:
jtricerolph 2026-07-29 17:28:35 +00:00
parent 4137813fc7
commit b9fdd97330
2 changed files with 27 additions and 2 deletions

View file

@ -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"
}
}

View file

@ -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}'],
},
}),
],
})