Skip to main content

type

First added

8.2.0

Default

"classic"

About

The module type with which the service worker should be registered. Usually used alongside rollupFormat.

Usage

export default defineConfig({
  plugins: [
    // Other plugins...
    serwist({
      type: "module",
      rollupFormat: "es",
      swSrc: "src/sw.ts",
      swDest: "sw.js",
      globDirectory: "dist",
      injectionPoint: "self.__SW_MANIFEST",
    }),
  ],
});

More resources

Here is a list of resources you can read to learn more about type: