music on atproto
plyr.fm
1import { sveltekit } from '@sveltejs/kit/vite';
2import { defineConfig } from 'vite';
3import { SvelteKitPWA } from '@vite-pwa/sveltekit';
4
5export default defineConfig({
6 plugins: [
7 sveltekit(),
8 SvelteKitPWA({
9 strategies: 'generateSW',
10 registerType: 'autoUpdate',
11 manifest: false,
12 workbox: {
13 globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
14 runtimeCaching: [
15 {
16 // audio streaming: bypass SW entirely to avoid iOS PWA hangs
17 // (the redirect to R2 CDN + range requests don't play well with caching)
18 urlPattern: /^https:\/\/api\.plyr\.fm\/audio\/.*/i,
19 handler: 'NetworkOnly'
20 },
21 {
22 urlPattern: /^https:\/\/api\.plyr\.fm\/.*/i,
23 handler: 'NetworkFirst',
24 options: {
25 cacheName: 'api-cache',
26 expiration: {
27 maxEntries: 50,
28 maxAgeSeconds: 60 * 60
29 }
30 }
31 }
32 ]
33 }
34 })
35 ]
36});