finds.dev← search

// the find

hanford/next-offline

★ 1,599 · JavaScript · updated Jan 2023

make your Next.js application work offline using service workers via Google's workbox

next-offline is a Next.js plugin that wires up Google's Workbox to generate a service worker for your app, enabling offline support and PWA-style caching with minimal config. It targets Next.js developers who want offline-first behavior without hand-writing service worker logic. The plugin wraps your next.config.js and handles the webpack integration.

The default NetworkFirst caching strategy is a sensible choice for most apps — you get fresh content when online and a fallback when not, without any configuration. The `generateInDevMode` and `devSwSrc` options show real understanding of the dev workflow pain point where service workers cause stale cache headaches. Runtime registration via `next-offline/runtime` is a clean escape hatch for apps that need lifecycle control. The plugin correctly handles the `next export` static export path, which historically broke service worker setups.

Last push was January 2023 and it still references Now 1.0/2.0 (rebranded to Vercel years ago) — this package has not tracked the Next.js App Router, which fundamentally changes how assets are emitted and would break the webpack integration. The blanket `urlPattern: /^https?.*/` default cache rule will cache third-party requests you almost certainly don't want cached, including analytics and auth endpoints. The monorepo setup shows four example packages but they all target Next.js 8-9 era conventions, so the examples are largely useless for anyone on a current Next.js version. Next.js itself now has first-party PWA guidance and `@ducanh2912/next-pwa` has stepped in as the maintained successor — this one is effectively abandoned.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →