- Integrated vite-plugin-pwa into the Vite configuration to enhance the application with Progressive Web App capabilities. - Configured service worker caching for OpenStreetMap tiles and defined the app's manifest with essential properties and icons.
48 lines
1.0 KiB
TypeScript
48 lines
1.0 KiB
TypeScript
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import { defineConfig } from 'vite';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
sveltekit(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['favicon.svg'],
|
|
manifest: {
|
|
name: 'Surveilled',
|
|
short_name: 'Surveilled',
|
|
description: 'Surveilled application',
|
|
theme_color: '#0a0a0a',
|
|
background_color: '#0a0a0a',
|
|
display: 'standalone',
|
|
icons: [
|
|
{
|
|
src: 'favicon.svg',
|
|
sizes: 'any',
|
|
type: 'image/svg+xml',
|
|
},
|
|
],
|
|
},
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^https:\/\/.*\.tile\.openstreetmap\.org\/.*/i,
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'openstreetmap-tiles',
|
|
expiration: {
|
|
maxEntries: 1000,
|
|
maxAgeSeconds: 60 * 60 * 24 * 7,
|
|
},
|
|
cacheableResponse: {
|
|
statuses: [0, 200],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
],
|
|
});
|