CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-workbox-webpack-plugin

tessl install tessl/npm-workbox-webpack-plugin@7.3.0

A plugin for your Webpack build process, helping you generate a manifest of local files that workbox-sw should precache.

Agent Success

Agent success rate when using this tile

80%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.19x

Baseline

Agent success rate without this tile

67%

task.mdevals/scenario-10/

Sourcemap-Safe Precache Build

Build a bundling routine that injects a precache manifest into a service worker while keeping the generated sourcemap accurate after the placeholder replacement.

Capabilities

Manifest injection with map output

  • Given a service worker source file containing the placeholder __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. @test

Mapping integrity after insertion

  • The generated sourcemap keeps the original line-and-column mappings for code before and after the placeholder, so statements following the injected manifest still resolve to their original source locations. @test

Map regeneration when manifest changes

  • Changing the manifest entries between builds updates both sw.js and sw.js.map so the map length and mappings match the new manifest string rather than a stale offset. @test

Implementation

@generates

API

/**
 * 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);

Dependencies { .dependencies }

workbox-webpack-plugin { .dependency }

Provides bundle-time precache manifest injection and sourcemap-aware replacement. @satisfied-by

webpack { .dependency }

Build toolchain used to compile the service worker bundle and emit assets. @satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/workbox-webpack-plugin@7.3.x
tile.json