Reputation: 843
I am using Vite PWA plugin. The prompt behavior works but only while the browser is open. If I close the browser and open it again, a new service worker is activated without any prompts.
Is there a way to prevent it?
I need this because we don't want a new version of the app to be installed unless a user explicitly confirms it - it has to do with data integrity: a new version of the app might potentially break using the current user's data in Indexed DB.
Excerpt from my vite config:
VitePWA({
strategies: 'generateSW',
registerType: 'prompt',
devOptions: {
enabled: true,
},
filename: 'service-worker.js',
I tried both Vite PWA strategies: generateSW and injectManifest with custom service-worker.ts script
Upvotes: 2
Views: 27