import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { VitePWA } from 'vite-plugin-pwa'; export default defineConfig({ plugins: [ react(), VitePWA({ registerType: 'prompt', includeAssets: ['logo.svg', 'star.svg', 'apple-touch-icon.png'], manifest: { id: '/', name: 'RideBus — расписание транспорта', short_name: 'RideBus', description: 'Остановки, ближайшие отправления и избранное', lang: 'ru', start_url: '/', scope: '/', display: 'standalone', background_color: '#faf9f6', theme_color: '#f3f3fa', icons: [ { src: '/icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' }, { src: '/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'any' }, { src: '/icon-maskable.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' }, ], }, workbox: { globPatterns: ['**/*.{js,css,html,woff2,png,svg,webmanifest}'], // The map is online-only and loads on demand; keep the offline shell small. globIgnores: ['**/StopsMap-*', '**/maplibre-gl-worker-*'], navigateFallbackDenylist: [/^\/api\//], // API snapshots are kept in IndexedDB, keyed by city and stop. // The service worker only caches the application shell. cleanupOutdatedCaches: true, clientsClaim: true, }, }), ], build: { target: 'es2022' }, });