Repository navigation
Replies: 1 comment 2 replies
|
Hi @duyz, the standard way to do this in Solid 2 is 1. Install the plugin (plus npm i -D vite-plugin-pwa workbox-window2. Add it to your Vite config, alongside Solid's plugin. In Solid 2 the app is built with import { defineConfig } from 'vite'
import solid from '@solidjs/vite-plugin'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({
plugins: [
solid(),
VitePWA({
registerType: 'autoUpdate',
manifest: {
name: 'My Solid App',
short_name: 'My App',
theme_color: '#ffffff',
icons: [
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' }
]
}
})
]
})3. Register the service worker from your app code. The plugin provides a Solid-specific virtual module — import { useRegisterSW } from 'virtual:pwa-register/solid'
const { offlineReady, needRefresh, updateServiceWorker } = useRegisterSW()4. A few things that trip people up:
Sources: the |






Uh oh!
There was an error while loading. Please reload this page.
I want to build a Progressive Web App (PWA) using SolidJS 2. How should I get started?
All reactions