Next.js Discord

Discord Forum

Serwist Service Worker

Unanswered
Patterdale Terrier posted this in #help-forum
Open in Discord
Patterdale TerrierOP
I use a serwist as a service worker for PSA/offline support here... But I don't know how to disable it in dev mode... Because of its aggressive caching, when I make any changes locally, it causes errors because there's now conflict between cached data and the changed data... (I have been working around this by unregistering the service worker every time I make any change in dev but it's not an efficient way to work)

I can see the disable option in the [serwist docs](https://serwist.pages.dev/docs/next/configuring/disable) ... I am thinking of doing something like

disable: process.env.NODE_ENV === "development"


But I don't know how I'll wire it into the next.config.mjs I have here https://github.com/repro123/foreing-exhange-curency-converter/blob/main/next.config.mjs

5 Replies