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') { ...@@ -49,11 +49,25 @@ if (process.env.NODE_ENV === 'production') {
cacheId: 'vue-hn', cacheId: 'vue-hn',
filename: 'service-worker.js', filename: 'service-worker.js',
dontCacheBustUrlsMatching: /./, dontCacheBustUrlsMatching: /./,
staticFileGlobsIgnorePatterns: [/index\.html$/, /\.map$/], staticFileGlobsIgnorePatterns: [/\.map$/, /\.json$/],
dynamicUrlToDependencies: { runtimeCaching: [
'/': glob.sync('./dist/*.js'), {
'/top': glob.sync('./dist/*.js') 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