Next.js Discord

Discord Forum

PWA

Answered
Tenterfield Terrier posted this in #help-forum
Open in Discord
Original message was deleted.
Answered by joulev
if you need offline caching you will need to write a service worker. nextjs doesnt do anything for you wrt service workers, but if you want to do it yourself you can just start writing a public/sw.js file

that said, using something like serwist will make it significantly easier
View full answer

2 Replies

Original message was deleted
if you need offline caching you will need to write a service worker. nextjs doesnt do anything for you wrt service workers, but if you want to do it yourself you can just start writing a public/sw.js file

that said, using something like serwist will make it significantly easier
Answer
Original message was deleted
that is handled by caching, you should check serwist's documentation to see how it caches things. the default nextjs caching rules is [here](https://github.com/serwist/serwist/blob/0a0ba5c0c2e04431a23ac455097329a4a5147efd/packages/next/src/index.worker.ts#L16) but you can of course implement your own rules