Skip to main content

@serwist/build

Introduction

@serwist/build is a module that integrates into your build process, helping you generate a manifest of local files that should be precached.

Available modes

  • InjectManifest — Generates a manifest of local files that should be precached, injects it into the service worker, and returns a list of warnings, the number of precache entries, and the number of bytes that they accumulate to.
  • GetManifest — Conceptually similar to InjectManifest, but it simply returns the manifest instead of injecting it into the source.

Each mode’s use cases

When to use InjectManifest?

  • You want Serwist to inject the precache manifest for you.

When to use GetManifest?

  • You want to have even more postprocess control over the precache manifest and inject it into the service worker yourself.

Configuration

See Configuring.

Frameworks

If you are using a framework, chances are that this module isn’t for you. We have already implemented integrations that use this module under the hood for various frameworks, bundlers, and build tools: