Files
patriothacks/vite.config.ts
T

54 lines
1.7 KiB
TypeScript

import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
// Workbox-based service worker: precaches the app shell (HTML/JS/CSS
// bundle) for offline load. The manifest below gives the app its
// installable Alipay/WeChat/Tuya mini-app-launcher identity.
VitePWA({
registerType: 'autoUpdate',
// Registration is done explicitly in src/main.tsx via the
// 'virtual:pwa-register' module, not auto-injected into index.html,
// so the shell root owns the registration call.
injectRegister: false,
manifest: {
name: 'The Commons',
short_name: 'The Commons',
description:
'The Commons - one shared identity, wallet, and event log across every civic mini-app in the Hollow.',
start_url: '/',
display: 'standalone',
// Alipay/WeChat/Tuya-inspired theme tokens: Alipay blue as the primary
// accent, a near-white app background matching the mini-app-launcher feel.
theme_color: '#1677FF',
background_color: '#F5F6F7',
icons: [
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: 'pwa-maskable-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
workbox: {
globPatterns: ['**/*.{js,css,html,svg,png,ico}'],
},
}),
],
})