Skip to main content

swUrl

First added

next-pwa

About

The URL to the service worker.

Why?

Serwist, by providing the option swDest, made itself unable to determine the URL to the service worker. As a result, it assumes that this URL is “/sw.js”. However, sometimes you might want something else, providing purpose for this option.

Usage

withSerwistInit({
  swSrc: "app/sw.ts",
  swDest: "public/weird-sw.js",
  swUrl: "/weird-sw.js",
});