Created
April 19, 2018 02:15
-
-
Save dYb/eb5a2b6145dd0a9be6ddfe862fcd8539 to your computer and use it in GitHub Desktop.
workbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return workboxBuild.generateSW({ | |
cacheId: 'assassins-workbox', | |
globDirectory: 'dist', | |
globPatterns: [ | |
'**/*.{js,css}', | |
], | |
globIgnores: [ | |
'**/*-sw.js', | |
'*.html' | |
], | |
// importWorkboxFrom: 'disabled', | |
// importScripts: [ | |
// 'https://static.ws.126.net/utf8/libs/workbox/v3.1.0/workbox-sw.js' | |
// ], | |
ignoreUrlParametersMatching: [/./], | |
dontCacheBustUrlsMatching: /./, | |
modifyUrlPrefix: { | |
'': `https://static.ws.126.net/163/frontend/${projectName}/` | |
}, | |
clientsClaim: true, | |
skipWaiting: true, | |
runtimeCaching: [{ | |
urlPattern: /.*openNewsapp\.js$/, | |
handler: 'staleWhileRevalidate', | |
options: { | |
cacheName: 'open-newsapp', | |
expiration: { | |
maxEntries: 3, | |
}, | |
cacheableResponse: { | |
statuses: [0, 200] | |
} | |
} | |
}], | |
swDest: `dist/${type}-sw.js`, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment