Add PWA support (vite-plugin-pwa)

Manifest with standalone display, dark theme color, 192/512 icons.
NetworkFirst workbox strategy for API routes. Dockerfile uses
--legacy-peer-deps for vite-plugin-pwa peer dep conflict with Vite 8.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Maddox 2026-04-07 21:02:20 -04:00
parent 57cb35d565
commit e97f620dff
6 changed files with 4141 additions and 4 deletions

View file

@ -1,7 +1,7 @@
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
RUN npm ci --legacy-peer-deps
COPY . .
ARG VITE_API_URL=
RUN npm run build

4088
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -33,6 +33,7 @@
"tailwindcss": "^4.2.2",
"typescript": "~6.0.2",
"typescript-eslint": "^8.58.0",
"vite": "^8.0.4"
"vite": "^8.0.4",
"vite-plugin-pwa": "^1.2.0"
}
}

BIN
public/pwa-192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
public/pwa-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View file

@ -1,9 +1,59 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({
plugins: [react(), tailwindcss()],
plugins: [
react(),
tailwindcss(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.svg'],
manifest: {
name: 'Store Tracker',
short_name: 'Stores',
description: 'Manage store matching rules for Firefly transaction categorization',
theme_color: '#0f1117',
background_color: '#0f1117',
display: 'standalone',
orientation: 'portrait',
scope: '/',
start_url: '/',
icons: [
{
src: 'pwa-192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'pwa-512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: 'pwa-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable',
},
],
},
workbox: {
globPatterns: ['**/*.{js,css,html,svg,png,ico}'],
runtimeCaching: [
{
urlPattern: /^\/api\//,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
expiration: { maxEntries: 50, maxAgeSeconds: 300 },
},
},
],
},
}),
],
server: {
proxy: {
'/api': 'http://192.168.1.80:45581',