eratic / packages / core / astro.mjs
193 words
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Vite settings shared by all four sites.
 *
 * Imported by each astro.config.mjs. Kept as plain .mjs rather than living in
 * src/ because Astro loads its config before any TypeScript path resolution
 * exists.
 */

/**
 * Vite inlines any asset under 4 kB as a `data:` URI. That is a good default
 * for small images and a silent bug for fonts here, because the site's
 * Content-Security-Policy sets `font-src 'self'` — a data: URI is not 'self',
 * so the browser refuses to load it and the glyphs simply never arrive.
 *
 * It only bites the handful of subsets that happen to be small: JetBrains
 * Mono's cyrillic-ext subset is 3.6 kB, so it was inlined and blocked while
 * the other seventeen font files loaded normally. Exactly the kind of failure
 * that hides for a year and then shows up as tofu in someone's name.
 *
 * Returning `false` forces a real file; returning `undefined` leaves Vite's
 * normal size-based decision in place for everything else.
 */
export const sharedVite = {
	build: {
		assetsInlineLimit(filePath) {
			if (/\.(woff2?|ttf|otf|eot)$/i.test(filePath)) return false;
			return undefined;
		},
	},
};

static mirror of HEAD · about · clone: git clone https://git.makefuture.ro/eratic.git