2025-03-02 23:33:11 +01:00
|
|
|
import workbox from 'workbox-build';
|
2021-02-21 21:59:39 +01:00
|
|
|
|
|
|
|
workbox.generateSW({
|
|
|
|
cacheId: 'blockbench',
|
|
|
|
globDirectory: './',
|
|
|
|
globPatterns: [
|
|
|
|
'./index.html',
|
|
|
|
'./favicon.png',
|
2023-12-14 19:21:30 +01:00
|
|
|
'./icon_maskable.png',
|
2021-02-21 21:59:39 +01:00
|
|
|
|
2025-03-02 23:31:06 +01:00
|
|
|
'./dist/**/*',
|
2021-02-21 21:59:39 +01:00
|
|
|
'./css/**/*',
|
|
|
|
'./assets/**/*',
|
|
|
|
'./font/*',
|
|
|
|
],
|
|
|
|
swDest: './service_worker.js',
|
2023-12-14 19:21:30 +01:00
|
|
|
maximumFileSizeToCacheInBytes: 4_096_000,
|
2021-02-21 21:59:39 +01:00
|
|
|
sourcemap: false
|
|
|
|
}).then(({count, size}) => {
|
|
|
|
console.log(`Generated service-worker, which will precache ${count} files, totaling ${(size/1e6).toFixed(2)} MB.`);
|
|
|
|
});
|