36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { sveltekit } from '@sveltejs/kit/vite';
|
|||
|
|
import { imagetools } from 'vite-imagetools';
|
||
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
||
|
|
import { defineConfig } from 'vite';
|
||
|
|
|
||
|
|
export default defineConfig({
|
||
|
|
plugins: [
|
||
|
|
sveltekit(),
|
||
|
|
imagetools(),
|
||
|
|
VitePWA({
|
||
|
|
registerType: 'autoUpdate',
|
||
|
|
// Pas d'injection par le plugin : l'enregistrement est le fichier statique
|
||
|
|
// static/registerSW.js (chemins absolus), lié dans app.html — CSP script-src 'self'.
|
||
|
|
injectRegister: false,
|
||
|
|
// Le manifest est le fichier statique static/manifest.webmanifest,
|
||
|
|
// déjà lié dans app.html — ne pas en générer un second.
|
||
|
|
manifest: false,
|
||
|
|
workbox: {
|
||
|
|
// Fallback hors-ligne réservé aux navigations HTML :
|
||
|
|
// les PDF presse et autres assets servis en navigation directe en sont exclus.
|
||
|
|
navigateFallback: '/offline/index.html',
|
||
|
|
navigateFallbackDenylist: [/^\/assets\//],
|
||
|
|
globPatterns: ['**/*.{js,css,html,woff2,png,svg,ico,webmanifest}'],
|
||
|
|
globIgnores: ['assets/press/**'],
|
||
|
|
maximumFileSizeToCacheInBytes: 3 * 1024 * 1024,
|
||
|
|
cleanupOutdatedCaches: true,
|
||
|
|
clientsClaim: true,
|
||
|
|
skipWaiting: true
|
||
|
|
},
|
||
|
|
devOptions: {
|
||
|
|
enabled: false
|
||
|
|
}
|
||
|
|
})
|
||
|
|
]
|
||
|
|
});
|