feat: add pages without ending slash for caching
This commit is contained in:
parent
ae645c62a6
commit
0608f9c286
1 changed files with 6 additions and 1 deletions
7
index.js
7
index.js
|
@ -92,6 +92,11 @@ export default function serviceWorker(config) {
|
||||||
?? [];
|
?? [];
|
||||||
|
|
||||||
const _pages = pages
|
const _pages = pages
|
||||||
|
.map(({pathname}) => pathname)
|
||||||
|
.filter(pathname => pathname !== '')
|
||||||
|
?? [];
|
||||||
|
|
||||||
|
const _pagesWithoutEndSlash = pages
|
||||||
.map(({pathname}) => {
|
.map(({pathname}) => {
|
||||||
const lastChar = pathname.slice(-1);
|
const lastChar = pathname.slice(-1);
|
||||||
const len = pathname.length;
|
const len = pathname.length;
|
||||||
|
@ -102,7 +107,7 @@ export default function serviceWorker(config) {
|
||||||
.filter(pathname => pathname !== '')
|
.filter(pathname => pathname !== '')
|
||||||
?? [];
|
?? [];
|
||||||
|
|
||||||
assets = [...new Set([...assets, ..._routes, ..._pages])]
|
assets = [...new Set([...assets, ..._routes, ..._pages, ..._pagesWithoutEndSlash])]
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('[astro-sw] Using service worker:', swPath);
|
console.log('[astro-sw] Using service worker:', swPath);
|
||||||
|
|
Loading…
Reference in a new issue