Skip to content

Commit

Permalink
optimize service worker config
Browse files Browse the repository at this point in the history
  • Loading branch information
mayswind committed Oct 9, 2023
1 parent 28a1080 commit 2389208
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions vite.config.js
Expand Up @@ -78,16 +78,13 @@ export default defineConfig(async () => {
'mobile.html',
'desktop.html',
'robots.txt',
'img/splash_screens/*',
'img/desktop/*',
'fonts/*.eot',
'fonts/*.ttf',
'fonts/*.svg',
'fonts/*.woff',
'css/vendor-desktop-*.css',
'css/desktop-*.css',
'js/vendor-desktop-*.js',
'js/desktop-*.js'
'css/*.css',
'js/*.js'
],
runtimeCaching: [
{
Expand All @@ -107,19 +104,19 @@ export default defineConfig(async () => {
handler: 'NetworkFirst'
},
{
urlPattern: /.*\/img\/(splash_screens|desktop)\/.*\.(png|jpg|jpeg|gif|tiff|bmp|svg)/,
urlPattern: /.*\/img\/desktop\/.*\.(png|jpg|jpeg|gif|tiff|bmp|svg)/,
handler: 'StaleWhileRevalidate'
},
{
urlPattern: /.*\/fonts\/.*\.(eot|ttf|svg|woff)/,
handler: 'CacheFirst'
},
{
urlPattern: /.*\/css\/(vendor-desktop-\.*|desktop-\.*)\.css/,
urlPattern: /.*\/css\/.*\.css/,
handler: 'CacheFirst'
},
{
urlPattern: /.*\/js\/(vendor-desktop-\.*|desktop-\.*)\.js/,
urlPattern: /.*\/js\/.*\.js/,
handler: 'CacheFirst'
}
],
Expand Down

0 comments on commit 2389208

Please sign in to comment.