Cache thumbnails in service worker (#1044)

* Cache thumbnails in service worker

* comment
This commit is contained in:
David Straub
2026-04-06 11:41:08 +02:00
committed by GitHub
parent 6faa73f0fc
commit 5c3b8c65a2
12 changed files with 150 additions and 31 deletions
+10 -8
View File
@@ -1,6 +1,6 @@
import {rollupPluginHTML as html} from '@web/rollup-plugin-html'
import {polyfillsLoader} from '@web/rollup-plugin-polyfills-loader'
import {generateSW} from 'rollup-plugin-workbox'
import {injectManifest} from 'rollup-plugin-workbox'
import resolve from '@rollup/plugin-node-resolve'
import terser from '@rollup/plugin-terser'
import replace from '@rollup/plugin-replace'
@@ -31,16 +31,18 @@ export default {
chunkFileNames: developmentMode ? '[name].js' : '[hash].js',
assetFileNames: developmentMode ? '[name][extname]' : '[hash][extname]',
plugins: [
generateSW({
globIgnores: ['polyfills/*.js', 'legacy-*.js', 'nomodule-*.js'],
navigateFallback: `${BASE_DIR}/index.html`,
navigateFallbackDenylist: [/^\/api.*/],
injectManifest({
swSrc: 'src/sw.js',
swDest: path.join(outputDir, 'sw.js'),
globDirectory: outputDir,
globPatterns: ['**/*.{html,js,css,webmanifest}'],
skipWaiting: false,
clientsClaim: false,
runtimeCaching: [{urlPattern: 'polyfills/*.js', handler: 'CacheFirst'}],
globIgnores: ['polyfills/*.js', 'legacy-*.js', 'nomodule-*.js'],
plugins: [
replace({
BASE_DIR: JSON.stringify(BASE_DIR),
preventAssignment: true,
}),
],
}),
],
},