English
@vite-pwa/workbox-swkit
The modern toolkit for modern web apps. @vite-pwa/workbox-swkit provides a consolidated, ESM-powered collection of JavaScript libraries to construct powerful, offline-first Progressive Web Apps right inside your service worker context.
Install
bash
pnpm add -D @vite-pwa/workbox-swkitbash
yarn add -D @vite-pwa/workbox-swkitbash
npm i -D @vite-pwa/workbox-swkitNew Features
@vite-pwa/workbox-swkit introduces a major architectural shift alongside new capabilities:
- Consolidated Architecture: Everything that was previously scattered across multiple independent packages is now unified into this single package using subpackage exports.
- Barrel Export: It exports a main barrel file containing all APIs. Important: This is designed to be exclusively processed by
@vite-pwa/workbox-buildor@vite-pwa/workbox-cli. Their internal engines (Vite/Rolldown) handle the aggressive tree-shaking for your service worker. Consuming this barrel directly with your own application bundler is not supported. - Dual Build Orchestration: when dual service workers are enabled (classic and ESM), the
@vite-pwa/workbox-buildengine compiles both builds independently and in parallel. @vite-pwa/workbox-swkit/precaching: Adds a newparalleloption to allow precaching in parallel, instead of sequentially.