• English
  • Introduction

    What does this plugin do?

    It uses workbox-build to generate a Service Worker (SW) that precaches (by default) all assets emitted by Rsbuild. It also generates a SW registration script and a web app manifest, and injects them into HTML. Every step except SW generation is optional, so you can register the SW and add the web app manifest manually.

    Limitations

    • HTML plugin is required to inject the SW registration script and the web app manifest link. If it's disabled, you'll need to perform these steps manually.

    Usage

    npm install -D rsbuild-plugin-pwa
    // rsbuild.config.ts
    import { defineConfig } from "@rsbuild/core";
    import { pluginPWA } from "rsbuild-plugin-pwa";
    export default defineConfig({
      plugins: [pluginPWA()],
    });

    API