A plugin for your Webpack build process, helping you generate a manifest of local files that workbox-sw should precache.
Overall
score
80%
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.
@generates
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>;Provides the manifest-injection tooling needed to emit the final service worker with its precache manifest.
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