A plugin for your Webpack build process, helping you generate a manifest of local files that workbox-sw should precache.
Overall
score
80%
Build a bundling routine that injects a precache manifest into a service worker while keeping the generated sourcemap accurate after the placeholder replacement.
__INJECT_PRECACHE__ and an external sourcemap comment, running the build writes sw.js with that placeholder replaced by the provided manifest entries and emits sw.js.map that references the injected code instead of the placeholder. @testsw.js and sw.js.map so the map length and mappings match the new manifest string rather than a stale offset. @test@generates
/**
* Builds a service worker bundle with an injected precache manifest and sourcemap support.
*
* @param {Object} options
* @param {string} options.swSrc - Path to the service worker source that includes the manifest placeholder.
* @param {string} options.swDest - Output path for the built service worker JavaScript file.
* @param {Array<{url: string, revision: string}>} options.manifestEntries - Precache entries to inject.
* @param {string} [options.publicPath] - Optional public URL prefix to apply to manifest URLs.
* @param {boolean} [options.enableSourceMap=true] - Whether to emit and update a sourcemap alongside the output.
* @returns {Promise<{swPath: string, mapPath?: string}>} Resolves with written file paths once bundling completes.
*/
async function buildServiceWorker(options);Provides bundle-time precache manifest injection and sourcemap-aware replacement. @satisfied-by
Build toolchain used to compile the service worker bundle and emit assets. @satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-workbox-webpack-pluginevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10