Enable full PWA install experience in all web modes

- Add PWAInstallPrompt component for custom install UI and event handling
- Register PWAInstallPrompt in App.vue for global visibility
- Enable PWA features and install prompt in dev, test, and prod (vite.config.web.mts)
- Update service worker registration to work in all environments
- Update docs/build-web-script-integration.md with PWA install guidance and visual cues
- Add scripts/build-web.sh for unified web build/dev workflow

PWA is now installable and testable in all web environments, with clear user prompts and desktop support.
This commit is contained in:
Matthew Raymer
2025-07-11 04:41:38 +00:00
parent 8b95cc8d2b
commit 26f303bae9
12 changed files with 4443 additions and 22 deletions

View File

@@ -76,21 +76,40 @@ export default defineConfig(async ({ mode }) => {
return mergeConfig(baseConfig, {
...environmentConfig,
// Ensure source maps are enabled for development and test modes
// This affects both dev server and build output
sourcemap: mode === 'development' || mode === 'test',
// Server configuration inherited from base config
// CORS headers removed to allow images from any domain
plugins: [
VitePWA({
registerType: 'autoUpdate',
manifest: appConfig.pwaConfig?.manifest,
// Enable PWA in all web environments for consistent testing
devOptions: {
enabled: mode === 'development'
enabled: true, // ✅ Enable in all environments
type: 'module'
},
workbox: {
cleanupOutdatedCaches: true,
skipWaiting: true,
clientsClaim: true,
sourcemap: mode !== 'production',
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024 // 10MB
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10MB
// Environment-specific caching strategies
runtimeCaching: mode === 'production' ? [
{
urlPattern: /^https:\/\/api\./,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 // 24 hours
}
}
}
] : []
}
})
]