Vite plugin for integrating Serwist (a Workbox-inspired service worker library) into your Vite application. Current stable version is 9.5.7, with 10.0.0-preview.14 available. Supports React, Vue, Svelte, Preact, SolidJS, and TypeScript. Unlike Workbox, Serwist offers modern ESM-first architecture, full TypeScript support, and plugin-specific configurations for various frameworks. Published under the serwistjs GitHub organization with monthly release cadence.
npm install vite-plugin-serwistVerified import paths — ran on the pinned version, not inferred.
Configures SerwistPlugin with inject manifest mode, targeting a service worker source file and output.
Update injectionPoint to 'self.__SW_MANIFEST' or explicitly set to 'self.__WB_MANIFEST'.
Use import syntax in an ESM project (type: 'module' in package.json or .mjs extension).
Ensure your service worker source uses the same injection point identifier as the plugin config.
Double-check that glob patterns are relative to the output directory (e.g., 'dist').
Run 'npm install vite-plugin-serwist' and ensure all peer deps (vite, etc.) are installed.
Use 'import { SerwistPlugin } from 'vite-plugin-serwist'' correctly.Ensure the service worker source file is only imported in a Web Worker or Service Worker environment.