English
@vite-pwa/workbox-build
The modern toolkit for modern web apps. @vite-pwa/workbox-build provides the essential, ESM-powered JavaScript libraries you need to build rock-solid, offline-ready Progressive Web Apps.
Requirements
@vite-pwa/workbox-build requires Node 22.14.0 or above.
You need to install the following dependencies to run @vite-pwa/workbox-build:
- Rolldown 1.0.0 or above: if you've installed Vite 8 or above, you don't need to install Rolldown as a dependency, because Vite 8 uses Rolldown; you need to install Rolldown when using Webpack, Rspack or Rsbuild
magicast0.5.0 or above: when usinggenerateSWstrategy only
Install
bash
pnpm add -D @vite-pwa/workbox-buildbash
yarn add -D @vite-pwa/workbox-buildbash
npm i -D @vite-pwa/workbox-buildBreaking Changes
The following breaking changes were introduced in the packages:
injectManifeststrategy doesn't build your service worker,@vite-pwa/workbox-buildjust injects the manifest into your service worker- removed service worker templates: consumer should use a custom service worker instead (using ESM notation)
New Features
@vite-pwa/workbox-build adds these new features:
buildSWstrategy: builds your service worker and injects the manifest into it when enabled.- Dual service worker generation, with
generateSWandbuildSWstrategies: useswTypeoption. - Dot
envfiles support:.env,.env.local,.env.[mode],.env.[mode].localfiles are supported. - Custom Rolldown/Vite plugins.
- Custom logs level configuration.
- Minify the service worker build, including comments (Rolldown options).
- Custom code splitting chunks: now it is possible to split your service worker code into multiple chunks, not just
workboxservice worker modules. - New
additionalManifestEntriesGeneratorfactory to allow using async generators to defer the manifest entries generation (read and calculate revision) until required. generateSWstrategy supports configuringparalleloption to allow precaching in parallel, instead of sequentially.generateSWstrategy supports configuringurlManipulationoption.- Build plugins for Vite, Webpack, Rspack and Rsbuild.