Add PWA manifest support and icons

App had no manifest, no service worker, and no icons — not
installable as a PWA at all.
This commit is contained in:
jtricerolph 2026-07-29 17:28:47 +00:00
parent 70908807f6
commit 6ed4601f11
4 changed files with 27 additions and 2 deletions

View file

@ -19,6 +19,7 @@
"@types/react-dom": "^18.3.1", "@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.4", "@vitejs/plugin-react": "^4.3.4",
"typescript": "^5.7.2", "typescript": "^5.7.2",
"vite": "^6.0.5" "vite": "^6.0.5",
"vite-plugin-pwa": "^1.3.0"
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

@ -1,7 +1,31 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({ export default defineConfig({
base: '/twin-optimiser/', base: '/twin-optimiser/',
plugins: [react()], plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
manifest: {
name: 'Twin Optimiser',
short_name: 'Twin Optimiser',
start_url: '/twin-optimiser/',
scope: '/twin-optimiser/',
display: 'standalone',
theme_color: '#c9841a',
background_color: '#c9841a',
icons: [
{ src: '/twin-optimiser/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
{ src: '/twin-optimiser/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
],
},
workbox: {
navigateFallback: '/twin-optimiser/index.html',
navigateFallbackDenylist: [/\/api\//],
globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
},
}),
],
}) })