vite-plugin-pwa adds progressive web app support to Vite projects with defaults for manifests and service workers. It works across Vue, React, Svelte, Solid, and Preact setups.
Overview
vite-plugin-pwa is a Vite plugin that automates progressive web app setup for front-end applications. It aims for zero-config defaults while exposing options to customize manifest generation, service worker behavior, and asset handling.
Service worker integration uses Workbox to provide offline caching strategies, including stale-while-revalidate with automatic reload when new content ships. Static assets can be included in offline caches. A development mode supports exercising custom service worker logic during local builds.
The plugin can inject a web app manifest, generate PWA icons and related assets from a source image, and serve or inject those assets at build time. Framework-specific helpers cover prompting users when updates are available for vanilla JavaScript, Vue 3, React, Svelte, SolidJS, and Preact.
It integrates with îles, SvelteKit, VitePress, Astro, Nuxt 3, and Remix. The package is framework-agnostic at its core and registers as VitePWA in vite.config. Node 20.19+ and Vite 5+ are required in recent releases.
Key features
- Workbox-based offline service workers
- Automatic web app manifest injection
- Stale-while-revalidate updates
- PWA asset generation from one image
- Framework update prompt helpers
- Offline static asset caching
- Service worker development debugging
- Meta-framework integration guides
Use cases
- Turning Vite SPAs into PWAs
- Offline-capable web applications
- Auto-updating deployed front ends
- SvelteKit or Nuxt PWA builds