How cansin/next-with-workbox works
next-with-workbox is a small Next.js configuration plugin that adds Workbox service-worker generation to the client webpack build. The workflow is: an application configures the wrapper, the wrapper preserves and invokes any existing webpack hook, then skips server and disabled development builds; enabled builds prepare output cleanup and precache options before selecting GenerateSW or InjectManifest. The README also documents application-side service-worker registration, which is external to this package. Relationships are based on the sampled index.js and README; no additional runtime modules are present in the tree.
Main entry points: index.js Webpack hook
Components 13
Next.js Integration
- Config wrapper
index.js - Webpack hook
index.js - Build gates
index.js
Worker Build
- Output cleanup
index.js - Precache options
index.js - GenerateSW mode
index.js - InjectManifest mode
index.js
Other components
- Next.js application
- Workbox webpack plugin
- Custom worker source
- Public assets
- Generated service worker
- Browser registration
Connections 14
- Next.js application → Config wrapper: configures
README.md - Config wrapper → Webpack hook: returns hook
index.js - Webpack hook → Build gates: checks build
index.js - Webpack hook → Output cleanup: adds cleanup
index.js - Webpack hook → Precache options: assembles options
index.js - Precache options → Public assets: scans assets
index.js - Webpack hook → GenerateSW mode: selects default
index.js - Webpack hook → InjectManifest mode: selects with source
index.js - GenerateSW mode → Workbox webpack plugin: configures plugin
index.js - InjectManifest mode → Workbox webpack plugin: configures plugin
index.js - InjectManifest mode → Custom worker source: reads source
index.js - Workbox webpack plugin → Generated service worker: generates output
README.md - Browser registration → Generated service worker: registers
README.md - Next.js application → Browser registration: implements example
README.md