U6: Lighthouse-gate in CI (mobiel+desktop >= 0.9), font-preload hero, privacyopzet bijgewerkt
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+28
-2
@@ -1,11 +1,37 @@
|
||||
/// <reference types="vitest/config" />
|
||||
import { defineConfig } from 'vite';
|
||||
import { defineConfig, type Plugin } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { version } from './package.json';
|
||||
|
||||
// Preloads the latin display font (Archivo, used by the hero heading and the
|
||||
// 2026 section) so it is requested with the HTML instead of after the CSS has
|
||||
// been parsed. Build only: in dev the bundle is not available.
|
||||
const preloadHeroFont = (): Plugin => ({
|
||||
name: 'preload-hero-font',
|
||||
transformIndexHtml: {
|
||||
order: 'post',
|
||||
handler(_html, ctx) {
|
||||
if (!ctx.bundle) return [];
|
||||
return Object.keys(ctx.bundle)
|
||||
.filter((file) => /archivo-latin-wdth-normal-.*\.woff2$/.test(file))
|
||||
.map((file) => ({
|
||||
tag: 'link',
|
||||
attrs: {
|
||||
rel: 'preload',
|
||||
as: 'font',
|
||||
type: 'font/woff2',
|
||||
href: `/${file}`,
|
||||
crossorigin: '',
|
||||
},
|
||||
injectTo: 'head-prepend' as const,
|
||||
}));
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
plugins: [react(), preloadHeroFont()],
|
||||
define: {
|
||||
// Injected at build time, used as the Sentry `release` tag (see src/main.tsx).
|
||||
__APP_VERSION__: JSON.stringify(version),
|
||||
|
||||
Reference in New Issue
Block a user