Skip to content

BasePartial ​

Interface workbox-build

Properties ​

PropertyTypeDefaultDescription
additionalManifestEntries?string | ManifestEntry[]A list of entries to be precached, in addition to any entries that are generated as part of the build configuration.
additionalManifestEntriesGenerator?() => AsyncGenerator<string | ManifestEntry, undefined, void>Async generator that yields additional entries to be preached. runs after additionalManifestEntries and glob patterns, but before manifestTransforms If the same URL appears more than once (e.g. from both static array and generator), a warning will be logged and the duplicate will be skipped.
dontCacheBustURLsMatching?RegExpAssets that match this will be assumed to be uniquely versioned via their URL, and exempted from the normal HTTP cache-busting that's done when populating the precache. While not required, it's recommended that if your existing build process already inserts a [hash] value into each filename, you provide a RegExp that will detect that, as it will reduce the bandwidth consumed when precaching.
failOnDuplicateManifestEntries?booleanfalseWhen true, throw an error listing all duplicate precache entry URLs.
manifestTransforms?ManifestTransform[]One or more functions which will be applied sequentially against the generated manifest. If modifyURLPrefix or dontCacheBustURLsMatching are also specified, their corresponding transformations will be applied first.
maximumFileSizeToCacheInBytes?number2097152This value can be used to determine the maximum size of files that will be precached. This prevents you from inadvertently precaching very large files that might have accidentally matched one of your patterns.
modifyURLPrefix?objectAn object mapping string prefixes to replacement string values. This can be used to, e.g., remove or add a path prefix from a manifest entry if your web hosting setup doesn't match your local filesystem setup. As an alternative with more flexibility, you can use the manifestTransforms option and provide a function that modifies the entries in the manifest using whatever logic you provide.

Example usage:

// Replace a '/dist/' prefix with '/', and also prepend
// '/static' to every URL.
modifyURLPrefix: {
  '/dist/': '/',
  '': '/static',
}
throwMaximumFileSizeToCacheInBytes?booleantrueShould maximumFileSizeToCacheInBytes exceeded throw an error?.

Released under the MIT License.