Skip to main content

Precaching

Default

By default, this is set to [/\/_next\/static\/.*(?<!\.p)\.woff2/, /\.map$/, /^manifest.*\.js$/].

Why?

Fonts

next/font includes all subsets out of the box. However, precaching all of them might be prove to be undesirable, for they may accumulate to an amount of data too large to precache, so they have been excluded by default.

.map files

These files do not serve any purpose to the users. As such, the plugin does not precache them by default.

.manifest.*.js files

This is to make sure we don't precache, e.g., the precache manifest file, or other manifests that are commonly generated by webpack but not useful for the users.

JS files

By default, all JS files are precached. However, this behaviour is not desired for larger apps. If your app fits this criterion, it is recommended that you manually filter out JS files that are not necessary.

const withPWA = require("@ducanh2912/next-pwa").default({
  // Your other options,
  workboxOptions: { exclude: ["/some-js-files.js"] },
});

module.exports = withPWA({
  // Your Next.js config
});