PWA optimization: vite-plugin-pwa, split misc.json, IndexedDB cache layer
This commit is contained in:
1 parent
c342a5b636
commit
8b27bd4767
70 files changed
+5612
-57852
No files matched your search
+55
-5
@@ -1,16 +1,66 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { resolve } from 'path';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tailwindcss()],
|
||||
plugins: [
|
||||
tailwindcss(),
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
workbox: {
|
||||
globPatterns: ['**/*.{js,css,html,woff,json,png}'],
|
||||
maximumFileSizeToCacheInBytes: 20 * 1024 * 1024,
|
||||
runtimeCaching: [
|
||||
{
|
||||
urlPattern: /\/data\/.*\.json$/,
|
||||
handler: 'StaleWhileRevalidate',
|
||||
options: {
|
||||
cacheName: 'ponomar-data',
|
||||
expiration: { maxEntries: 200, maxAgeSeconds: 60 * 60 * 24 * 30 },
|
||||
},
|
||||
},
|
||||
{
|
||||
urlPattern: /\/data\/.*\.text$/,
|
||||
handler: 'StaleWhileRevalidate',
|
||||
options: {
|
||||
cacheName: 'ponomar-bible',
|
||||
expiration: { maxEntries: 100, maxAgeSeconds: 60 * 60 * 24 * 30 },
|
||||
},
|
||||
},
|
||||
{
|
||||
urlPattern: /\/fonts\/.*\.woff2?$/,
|
||||
handler: 'CacheFirst',
|
||||
options: {
|
||||
cacheName: 'ponomar-fonts',
|
||||
expiration: { maxEntries: 10, maxAgeSeconds: 60 * 60 * 24 * 365 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
manifest: {
|
||||
name: 'Ponomar — Orthodox Calendar',
|
||||
short_name: 'Ponomar',
|
||||
description: 'Orthodox Church calendar and liturgical information',
|
||||
start_url: '/',
|
||||
display: 'standalone',
|
||||
background_color: '#f5f0e8',
|
||||
theme_color: '#1a1a2e',
|
||||
orientation: 'portrait',
|
||||
icons: [
|
||||
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
|
||||
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
port: 5173,
|
||||
strictPort: false
|
||||
strictPort: false,
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
sourcemap: true
|
||||
sourcemap: true,
|
||||
},
|
||||
publicDir: 'static'
|
||||
});
|
||||
publicDir: 'static',
|
||||
});
|
||||
Reference in new issue
Block a user