提交 37a9c661 编写于 作者: A Arunoda Susiripala 提交者: Guillermo Rauch

Make prefetching works again. (#422)

上级 de6521a4
......@@ -51,7 +51,10 @@ function sendReply (e, result) {
function cacheUrl (url) {
const req = new self.Request(url, {
mode: 'no-cors'
mode: 'no-cors',
headers: {
'Accept': 'application/json'
}
})
return self.caches.open(CACHE_NAME)
......
......@@ -108,11 +108,8 @@ export function prefetch (href) {
let { pathname } = urlParse(href)
// Add support for the index page
if (pathname === '/') {
pathname = '/index'
}
const url = `${pathname}.json`
const url = `/_next/pages${pathname}`
if (PREFETCHED_URLS[url]) return
messenger.send({ action: 'ADD_URL', url: url })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册