Skip to content

Commit

Permalink
Merge pull request #296 from shrashiti/patch-1
Browse files Browse the repository at this point in the history
Introduce an cacheStartUrl configuration
  • Loading branch information
shadowwalker authored Apr 17, 2022
2 parents 51686de + 41ab583 commit c176d85
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = (nextConfig = {}) => ({
sw = 'sw.js',
dynamicStartUrl = true,
dynamicStartUrlRedirect,
cacheStartUrl = true,
skipWaiting = true,
clientsClaim = true,
cleanupOutdatedCaches = true,
Expand Down Expand Up @@ -159,16 +160,18 @@ module.exports = (nextConfig = {}) => ({
}))
}

if (!dynamicStartUrl) {
manifestEntries.push({
url: basePath,
revision: buildId
})
} else if (typeof dynamicStartUrlRedirect === 'string' && dynamicStartUrlRedirect.length > 0) {
manifestEntries.push({
url: dynamicStartUrlRedirect,
revision: buildId
})
if (cacheStartUrl) {
if (!dynamicStartUrl) {
manifestEntries.push({
url: basePath,
revision: buildId
})
} else if (typeof dynamicStartUrlRedirect === 'string' && dynamicStartUrlRedirect.length > 0) {
manifestEntries.push({
url: dynamicStartUrlRedirect,
revision: buildId
})
}
}

let _fallbacks = fallbacks
Expand Down

0 comments on commit c176d85

Please sign in to comment.