scope
First added
8.2.0
Default
viteOptions.base
About
The service worker’s URL scope. Set to "/foo/"
so that paths under “/foo/” are under the service worker’s control while others are not.
Note: “/foo” does NOT belong to the aforementioned scope! Consider configuring how trailing slashes are handled.
Usage
export default defineConfig({
plugins: [
// Other plugins...
serwist({
scope: "/foo/",
swSrc: "src/sw.ts",
swDest: "sw.js",
globDirectory: "dist",
injectionPoint: "self.__SW_MANIFEST",
rollupFormat: "iife",
}),
],
});