35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { sveltekit } from '@sveltejs/kit/vite';
|
|||
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
||
|
|
import { defineConfig } from 'vite';
|
||
|
|
|
||
|
|
export default defineConfig({
|
||
|
|
plugins: [
|
||
|
|
sveltekit(),
|
||
|
|
// `VitePWA` directement, et non `@vite-pwa/sveltekit` : le playbook §2.9 impose
|
||
|
|
// l'enregistrement par fichier statique, l'intégration n'apporterait rien de plus
|
||
|
|
// et ajouterait une dépendance.
|
||
|
|
VitePWA({
|
||
|
|
registerType: 'autoUpdate',
|
||
|
|
// Enregistrement par fichier statique (playbook §2.9) : l'injection du plugin
|
||
|
|
// n'atteint pas le HTML prérendu et produit un chemin relatif cassé sur les
|
||
|
|
// routes imbriquées comme /fr/zerbaj/kowosol/.
|
||
|
|
injectRegister: false,
|
||
|
|
manifest: false,
|
||
|
|
workbox: {
|
||
|
|
globPatterns: ['**/*.{js,css,html,woff2,svg,webp,avif,png,opus}'],
|
||
|
|
navigateFallback: '/offline/index.html',
|
||
|
|
navigateFallbackDenylist: [/\.(?:png|jpg|jpeg|svg|webp|avif|woff2|opus)$/],
|
||
|
|
maximumFileSizeToCacheInBytes: 3 * 1024 * 1024,
|
||
|
|
cleanupOutdatedCaches: true,
|
||
|
|
clientsClaim: true,
|
||
|
|
skipWaiting: true
|
||
|
|
}
|
||
|
|
})
|
||
|
|
],
|
||
|
|
server: { fs: { strict: true } },
|
||
|
|
build: {
|
||
|
|
// Un budget se surveille : Vite prévient au-delà, on ne le découvre pas en production.
|
||
|
|
chunkSizeWarningLimit: 170
|
||
|
|
}
|
||
|
|
});
|