diff --git a/README.md b/README.md index 8e72a483..d5c2e0e4 100644 --- a/README.md +++ b/README.md @@ -262,11 +262,16 @@ module.exports = withPWA({ - default: `[]` - example: `[/chunks\/images\/.*$/]` - Don't precache files under `.next/static/chunks/images` (Highly recommend this to work with `next-optimized-images` plugin) - doc: Array of (string, RegExp, or function()). One or more specifiers used to exclude assets from the precache manifest. This is interpreted following the same rules as Webpack's standard exclude option. +- cacheStartUrl - whether to cache start url + - default: `true` + - [discussion of use case to not cache start url at all](https://github.com/shadowwalker/next-pwa/pull/296#issuecomment-1094167025) - dynamicStartUrl - if your start url returns different HTML document under different state (such as logged in vs. not logged in), this should be set to true. - default: `true` + - effective when `cacheStartUrl` set to `true` - recommend: set to **false** if your start url always returns same HTML document, then start url will be precached, this will help to speed up first load. - dynamicStartUrlRedirect - if your start url redirect to another route such as `/login`, it's recommended to setup this redirected url for the best user experience. - default: `undefined` + - effective when `dynamicStartUrlRedirect` set to `true` - fallbacks - config precached routes to fallback when both cache and network not available to serve resources. - **if you just need a offline fallback page, simply create a `/_offline` page such as `pages/_offline.js` and you are all set, no configuration necessary** - default: `object` diff --git a/index.js b/index.js index 5235a296..110bcd25 100644 --- a/index.js +++ b/index.js @@ -32,9 +32,9 @@ module.exports = (nextConfig = {}) => ({ register = true, dest = distDir, sw = 'sw.js', + cacheStartUrl = true, dynamicStartUrl = true, dynamicStartUrlRedirect, - cacheStartUrl = true, skipWaiting = true, clientsClaim = true, cleanupOutdatedCaches = true, diff --git a/package.json b/package.json index 9ed93cb8..a581cc4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "next-pwa", - "version": "5.5.1", + "version": "5.5.2", "description": "Next.js with PWA, powered by workbox.", "main": "index.js", "repository": "https://github.com/shadowwalker/next-pwa",