feat:#4 updated cache and workbox

This commit is contained in:
Elmar Kresse
2024-05-19 21:29:39 +02:00
parent 9a9b405910
commit 1c22c2c227
3 changed files with 19 additions and 2 deletions

View File

@ -11,7 +11,8 @@
<link rel="mask-icon" href="/htwk-mask.svg" color="#00494c" /> <link rel="mask-icon" href="/htwk-mask.svg" color="#00494c" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" /> <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<meta name="theme-color" content="#1b2022"> <meta name="theme-color" content="#1b2022">
<link <script src="/registerSW.js"></script>
<link
id="theme-link" id="theme-link"
rel="stylesheet" rel="stylesheet"
href="/themes/lara-light-blue/theme.css" href="/themes/lara-light-blue/theme.css"

View File

@ -15,3 +15,5 @@
//along with this program. If not, see <https://www.gnu.org/licenses/>. //along with this program. If not, see <https://www.gnu.org/licenses/>.
/// <reference types="vite/client" /> /// <reference types="vite/client" />
declare module 'ical.js';

View File

@ -67,7 +67,21 @@ export default defineConfig({
registerType: 'autoUpdate', registerType: 'autoUpdate',
workbox: { workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,json,vue,txt,woff2}'], globPatterns: ['**/*.{js,css,html,ico,png,svg,json,vue,txt,woff2}'],
cleanupOutdatedCaches: true cleanupOutdatedCaches: true,
runtimeCaching: [
{
urlPattern: /^https?.*/,
handler: 'NetworkFirst',
options: {
cacheName: 'https-calls',
expiration: {
maxEntries: 150,
maxAgeSeconds: 30 * 12 * 60 * 60, // 1 month
},
networkTimeoutSeconds: 10, // fall back to cache if api does not response within 10 seconds
},
},
],
}, },
devOptions: { devOptions: {
enabled: true, enabled: true,