Next.js Discord

Discord Forum

PWA

Answered
German Shepherd Dog posted this in #help-forum
Open in Discord
German Shepherd DogOP
I am pretty new to PWA's,
I have added a "manifest.json" to my application, but in order to get a full PWA I know I need to add way more than that.

Does next support everything out of the box? Or Do I need stuff like nextpwa to help me out with version control. offline caching ect. I do not expect to be spoonfed, but a push in the right direction would be nice:)
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

4 Replies

@German Shepherd Dog I am pretty new to PWA's, I have added a "manifest.json" to my application, but in order to get a full PWA I know I need to add way more than that. Does next support everything out of the box? Or Do I need stuff like nextpwa to help me out with version control. offline caching ect. I do not expect to be spoonfed, but a push in the right direction would be nice:)
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
@German Shepherd Dog I'd assume serwist will also take care of the versions? So the app "updates" whenever changes are deployed?
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