Add PWA manifest support and icons

App had no manifest, no service worker, and no icons — not
installable as a PWA at all despite having PWA meta tags in index.html.
This commit is contained in:
jtricerolph 2026-07-29 17:28:43 +00:00
parent bf538df2d9
commit eca07750d2
4 changed files with 27 additions and 2 deletions

View file

@ -19,6 +19,7 @@
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.4",
"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: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

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: '/plant/',
plugins: [react()],
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
manifest: {
name: 'Plant Room',
short_name: 'Plant Room',
start_url: '/plant/',
scope: '/plant/',
display: 'standalone',
theme_color: '#0e7490',
background_color: '#0e7490',
icons: [
{ src: '/plant/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
{ src: '/plant/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
],
},
workbox: {
navigateFallback: '/plant/index.html',
navigateFallbackDenylist: [/\/api\//],
globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
},
}),
],
})