Commit 6a243c60 authored by Evan You's avatar Evan You

properly cache dynamic content for offline: use networkFirst

parent 9376f9a8
......@@ -49,11 +49,25 @@ if (process.env.NODE_ENV === 'production') {
cacheId: 'vue-hn',
filename: 'service-worker.js',
dontCacheBustUrlsMatching: /./,
staticFileGlobsIgnorePatterns: [/index\.html$/, /\.map$/],
dynamicUrlToDependencies: {
'/': glob.sync('./dist/*.js'),
'/top': glob.sync('./dist/*.js')
}
staticFileGlobsIgnorePatterns: [/\.map$/, /\.json$/],
runtimeCaching: [
{
urlPattern: '/',
handler: 'networkFirst'
},
{
urlPattern: /\/(top|new|show|ask|jobs)/,
handler: 'networkFirst'
},
{
urlPattern: '/item/:id',
handler: 'networkFirst'
},
{
urlPattern: '/user/:id',
handler: 'networkFirst'
}
]
})
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment