This commit is contained in:
seb
2026-10-05 08:31:13 +02:00
parent 4d653304cd
commit 8010436157
5 changed files with 295 additions and 151 deletions

View File

@@ -37,6 +37,19 @@ if (import.meta.env.DEV) {
void clearDevServiceWorker();
}
// PWA auto-update: reload the page as soon as a new build's service worker
// takes control. The virtual module only exists in production builds (the
// plugin is registered for `build` only), hence the dynamic import.
if (import.meta.env.PROD && 'serviceWorker' in navigator) {
import('virtual:pwa-register')
.then(({ registerSW }) => {
registerSW({ immediate: true });
})
.catch(() => {
// No SW in this build — app still works, just without offline support.
});
}
createRoot(document.getElementById('root')).render(
<ThemeProvider theme={getActiveTheme()}>
<CssBaseline />