Skip to content

Commit

Permalink
Update settings for sw-precache-webpack-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
zyml committed May 29, 2017
1 parent b79c238 commit a87dda3
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions internals/webpack/webpack.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,40 @@ module.exports = (env = process.env) => {
minChunks: Infinity,
}),
new SWPrecachePlugin({
cacheId: 'vue-hn',
cacheId: 'nuswhispers-vue',
filename: 'service-worker.js',
dontCacheBustUrlsMatching: /./,
staticFileGlobsIgnorePatterns: [/index\.html$/, /\.map$/],
staticFileGlobsIgnorePatterns: [/index\.template\.html$/, /\.json$/, /\.map$/],
runtimeCaching: [
{
urlPattern: /^https:\/\/www\.nuswhispers\.com\/api/,
handler: 'networkFirst',
},
{
urlPattern: '/',
handler: 'networkFirst',
},
{
urlPattern: /\/(latest|popular|success|policy)/,
handler: 'networkFirst',
},
{
urlPattern: '/confession/:id',
handler: 'networkFirst',
},
{
urlPattern: '/category/:id',
handler: 'networkFirst',
},
{
urlPattern: '/tag/:id',
handler: 'networkFirst',
},
{
urlPattern: '/search/:id',
handler: 'networkFirst',
},
],
})
);
}
Expand Down

0 comments on commit a87dda3

Please sign in to comment.