mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-10 21:06:15 -08:00
add build-sw.js
This commit is contained in:
1 parent
be88f55657
commit
7e58717e07
7 files changed
+226
-167
No files matched your search
@@ -0,0 +1,14 @@
|
||||
const { generateSW } = require('workbox-build');
|
||||
|
||||
generateSW({
|
||||
globDirectory: 'docs/',
|
||||
globPatterns: ['assets/**/*.{css,woff2,png,svg,jpg,js}'],
|
||||
maximumFileSizeToCacheInBytes: 1024 * 1024 * 5,
|
||||
swDest: 'docs/sw.js',
|
||||
sourcemap: false,
|
||||
}).then(({ count, size, warnings }) => {
|
||||
if (warnings.length > 0) {
|
||||
console.warn('Warnings encountered while generating a service worker:', warnings.join('\n'));
|
||||
}
|
||||
console.log(`Generated a service worker, which will precache ${count} files, totaling ${size} bytes.`);
|
||||
});
|
||||
Reference in new issue
Block a user