Next has no service worker build step. Its PWA guide hand-writes public/sw.js for push notifications and names the community Serwist package for offline caching. @serwist/next wraps the Next config, compiles your worker, and injects the precache list. Next's own experimental useOffline hook retries failed navigations once the network returns; it is not a service worker.
import withSerwistInit from "@serwist/next";
const withSerwist = withSerwistInit({
swSrc: "app/sw.ts",
swDest: "public/sw.js",
});
export default withSerwist({
// Your Next.js config
});
Adapted from the Serwist getting-started guide (revision and offline-fallback entries omitted).