Critical fixes for PWA installation: 1. ✅ Use proper Vite PWA registration with virtual:pwa-register 2. ✅ Simplified manifest.json (removed verbose name, fixed orientation) 3. ✅ Added 'any maskable' dual-purpose icon for better compatibility 4. ✅ Removed crossorigin from manifest link (causes issues) 5. ✅ Simplified start_url to just '/' 6. ✅ Added msapplication-TileColor meta tag 7. ✅ Set injectRegister: 'auto' in Vite config 8. ✅ Use public/manifest.json directly instead of generating This should now work on Brave Browser Android with proper 'Install App' prompt. Test: Clear site data, visit site, should see install prompt within 30 seconds. Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { VitePWA } from 'vite-plugin-pwa'
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
injectRegister: 'auto',
|
|
includeAssets: ['icons/*.png', 'assets/fonts/*.otf'],
|
|
devOptions: {
|
|
enabled: false
|
|
},
|
|
manifest: false, // Use public/manifest.json instead
|
|
workbox: {
|
|
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB limit
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,jpg,jpeg,woff,woff2,otf}'],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^https:\/\/images\.unsplash\.com\/.*/i,
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'unsplash-images-cache',
|
|
expiration: {
|
|
maxEntries: 50,
|
|
maxAgeSeconds: 60 * 60 * 24 * 30 // 30 days
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
host: true
|
|
}
|
|
})
|