Make cashup installable as a PWA

vite-plugin-pwa with manifest scoped to /cashup/, purple £ icons matching
portal style, auto install prompt when opened with ?install=1 from the
portal dashboard, nginx no-cache rules for sw.js and manifest.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-11 10:54:50 +00:00
parent dec7ac2f3e
commit 4a46bcf45f
7 changed files with 6327 additions and 2 deletions

View file

@ -1,7 +1,33 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({
base: '/cashup/',
plugins: [react()],
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
manifest: {
name: 'Cash Up',
short_name: 'Cash Up',
start_url: '/cashup/',
scope: '/cashup/',
display: 'standalone',
theme_color: '#6b2d8b',
background_color: '#6b2d8b',
icons: [
{ src: '/cashup/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
{ src: '/cashup/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
],
},
workbox: {
navigateFallback: '/cashup/index.html',
// Never let the service worker intercept API calls — auth and data
// must always hit the backend fresh.
navigateFallbackDenylist: [/\/api\//],
globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
},
}),
],
})