SolidJSS
SolidJSโ€ข2y agoโ€ข
18 replies
Mango Juicy

Precache service worker

Is there any way to implement service worker for content precaching?
For context I'm creating a website with a midi player. It would be great to precache large (1 to 21 MB ish) SoundFont files.

I've tried using VitePWA plugin in Vinxi. It doesn't appear to register any service workers though.

app.config.ts:
import { defineConfig } from '@solidjs/start/config'
import { VitePWA } from 'vite-plugin-pwa'

export default defineConfig({
  vite: {
    ...
    plugins: [
      VitePWA({
        registerType: 'autoUpdate',
        workbox: {
          globPatterns: ['**/*.{ico,png,svg,jpg,webp,sf3,wasm}'],
        },
      }),
    ],
  },
  ...
})
Was this page helpful?