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-9/

CDN-aware Precache Manifest

A build helper that configures the service worker build plugin to reshape the precache manifest for CDN delivery and offline support.

Capabilities

Adds manual offline entries

  • Provided offline HTML and remote font URLs are always included in the precache manifest with the given revision or null revision so they remain cached even if the bundler skips them. @test

Rewrites manifest URLs

  • Every precache entry is rewritten to include the provided public base path except when the URL is already absolute; path joins avoid duplicate slashes. @test

Excludes noisy assets with warnings

  • Precache entries ending in .map or starting with /admin/ are removed and a warning string lists the removed URLs in the order they were filtered. @test

Normalizes revisions for hashed files

  • Files whose names already contain a fingerprint segment have their revision cleared while non-fingerprinted files keep their original revision values. @test

Implementation

@generates

API

export interface ManifestEntry {
  url: string;
  revision?: string | null;
}

export interface PrecacheConfigOptions {
  /**
   * Base public path (e.g., CDN prefix) to prepend to generated precache URLs.
   */
  basePath?: string;
  /**
   * Offline HTML asset that must always be in the manifest.
   */
  offlinePage: { url: string; revision: string };
  /**
   * Remote font or icon asset to precache without a revision value.
   */
  remoteFont: { url: string };
}

/**
 * Builds a plugin instance from the service worker tooling dependency that applies
 * the manifest rules in this spec and is ready to be placed in a bundler's plugin list.
 */
export function buildPrecachePlugin(options: PrecacheConfigOptions): unknown;

/**
 * Standalone manifest hook shared with the plugin for rewriting URLs,
 * filtering unwanted assets, and producing warnings.
 */
export function transformManifest(
  entries: ManifestEntry[],
  options: { basePath?: string }
): Promise<{ manifest: ManifestEntry[]; warnings: string[] }>;

/**
 * Returns the manual precache entries that must be injected alongside the generated manifest.
 */
export function manualEntries(options: PrecacheConfigOptions): ManifestEntry[];

Dependencies { .dependencies }

workbox-webpack-plugin { .dependency }

Provides the service worker build plugin and manifest customization hooks needed to shape the precache list.

Version

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