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

Service Worker Build Pipeline

Design a build helper that produces a precache-ready service worker. It should let consumers opt into compiling the worker source (including extra compilation plugins) or fall back to copying the source as-is while still emitting clear warnings about ignored compilation options.

Capabilities

Compiled service worker

  • When compilation is enabled, the service worker source is built through a dedicated compilation stage that accepts optional compilation plugins and writes the bundled worker to the requested destination, including the generated precache manifest. @test

Raw copy fallback

  • When compilation is disabled, the service worker source is copied unchanged to the destination, and a warning notes that compilation-only plugins were ignored. @test

Shared build context

  • Service worker compilation reuses the parent build’s filesystem/context so shared aliases or loaders resolve without additional configuration. @test

Implementation

@generates

API

export interface ServiceWorkerBuildOptions {
  /** Path to the source service worker file */
  swSrc: string;
  /** Destination filename for the emitted service worker */
  swDest: string;
  /** Whether to compile the source through a bundler pipeline */
  compile: boolean;
  /** Additional bundler plugins applied only during service worker compilation */
  compilationPlugins?: any[];
  /** The parent webpack compiler used to share context and filesystem */
  parentCompiler: import('webpack').Compiler;
  /** Optional hook for surfaced warnings */
  warn?: (message: string) => void;
}

export interface BuildResult {
  /** Absolute path to the emitted service worker */
  swOutputPath: string;
  /** Any warnings raised during the build */
  warnings: string[];
}

/**
 * Builds or copies the service worker based on the provided options.
 */
export function buildServiceWorker(options: ServiceWorkerBuildOptions): Promise<BuildResult>;

Dependencies { .dependencies }

workbox-webpack-plugin { .dependency }

Provides the manifest-injection tooling needed to emit the final service worker with its precache manifest.

Version

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