Skip to content

Commit c6c04e7

Browse files
committed
Make prefetching works again.
1 parent de6521a commit c6c04e7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

client/next-prefetcher.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ function sendReply (e, result) {
5151

5252
function cacheUrl (url) {
5353
const req = new self.Request(url, {
54-
mode: 'no-cors'
54+
mode: 'no-cors',
55+
headers: {
56+
'Accept': 'application/json'
57+
}
5558
})
5659

5760
return self.caches.open(CACHE_NAME)

lib/prefetch.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,8 @@ export function prefetch (href) {
108108

109109
let { pathname } = urlParse(href)
110110
// Add support for the index page
111-
if (pathname === '/') {
112-
pathname = '/index'
113-
}
114111

115-
const url = `${pathname}.json`
112+
const url = `/_next/pages${pathname}`
116113
if (PREFETCHED_URLS[url]) return
117114

118115
messenger.send({ action: 'ADD_URL', url: url })

0 commit comments

Comments
 (0)