Fix PWA install by registering service worker in theme
VitePress did not auto-inject SW registration; manual registerSW enables true app install on HTTPS. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,12 @@ import DefaultTheme from 'vitepress/theme'
|
||||
import { h } from 'vue'
|
||||
import InstallApp from './InstallApp.vue'
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
import('virtual:pwa-register').then(({ registerSW }) => {
|
||||
registerSW({ immediate: true })
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
extends: DefaultTheme,
|
||||
Layout: () => {
|
||||
|
||||
Reference in New Issue
Block a user