next-pwa icon indicating copy to clipboard operation
next-pwa copied to clipboard

How to use specific caching strategy with next-pwa ?

Open 1mehdifaraji opened this issue 4 years ago • 1 comments

How can I use a specific caching strategy with next pwa ?

For example I use it like this :

const withPWA = require("next-pwa"); const runtimeCaching = require("next-pwa/cache");

module.exports = withPWA({ pwa: { dest: "public", runtimeCaching, disable: process.env.NODE_ENV === "development", }, });

How can I use the network first caching strategy with next-pwa ?

1mehdifaraji avatar Aug 09 '21 19:08 1mehdifaraji

https://github.com/shadowwalker/next-pwa/blob/master/cache.js is a preset of runtime caching configuration, feel free to copy it, modify it as you like, then passing the configuration object into pwa section of your next.config.js with runtimeCaching key.

shadowwalker avatar Aug 16 '21 04:08 shadowwalker