Skip to content

Commit 8ec56b8

Browse files
committed
add cacheStartUrl config option
1 parent c176d85 commit 8ec56b8

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,16 @@ module.exports = withPWA({
262262
- default: `[]`
263263
- example: `[/chunks\/images\/.*$/]` - Don't precache files under `.next/static/chunks/images` (Highly recommend this to work with `next-optimized-images` plugin)
264264
- 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.
265+
- cacheStartUrl - whether to cache start url
266+
- default: `true`
267+
- [discussion of use case to not cache start url at all](https://github.com/shadowwalker/next-pwa/pull/296#issuecomment-1094167025)
265268
- 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.
266269
- default: `true`
270+
- effective when `cacheStartUrl` set to `true`
267271
- 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.
268272
- 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.
269273
- default: `undefined`
274+
- effective when `dynamicStartUrlRedirect` set to `true`
270275
- fallbacks - config precached routes to fallback when both cache and network not available to serve resources.
271276
- **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**
272277
- default: `object`

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ module.exports = (nextConfig = {}) => ({
3232
register = true,
3333
dest = distDir,
3434
sw = 'sw.js',
35+
cacheStartUrl = true,
3536
dynamicStartUrl = true,
3637
dynamicStartUrlRedirect,
37-
cacheStartUrl = true,
3838
skipWaiting = true,
3939
clientsClaim = true,
4040
cleanupOutdatedCaches = true,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next-pwa",
3-
"version": "5.5.1",
3+
"version": "5.5.2",
44
"description": "Next.js with PWA, powered by workbox.",
55
"main": "index.js",
66
"repository": "https://github.com/shadowwalker/next-pwa",

0 commit comments

Comments
 (0)