Webpack plugin (v1.0.0) that generates a service worker file using sw-precache to cache external project dependencies. Abandoned since 2019; no longer updated with new webpack versions. Key differentiator: simple integration for service worker caching in webpack builds, but superseded by workbox-webpack-plugin which is actively maintained and more feature-rich. Handles automatic cache busting, minification, and navigation fallback. Last stable release was 2017; requires Node >=4.
npm install sw-precache-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Shows basic webpack configuration to generate a service worker using SWPrecacheWebpackPlugin.
Migrate to workbox-webpack-plugin for webpack 5 support.
Replace with @angular/service-worker or workbox-webpack-plugin (GenerateSW).
Set filename option to match desired scope path (e.g., '/service-worker.js').
Use /regex/ pattern literals or new RegExp() objects.
Ensure publicPath ends with '/' and path is absolute.
npm install --save-dev sw-precache-webpack-plugin
Use const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin'); or if using ESM, ensure bundler supports default interop.Use array of RegExp objects, e.g., [/pattern/].
Ensure service-worker.js is placed in the build directory and service worker is registered from the same path.