perf: keep Markdown segmentation for single-line display math and ship KaTeX fonts as files

This commit is contained in:
mesalogo
2026-10-02 14:41:56 +08:00
parent 80579ee421
commit 3d4e9577b5
5 changed files with 139 additions and 21 deletions
+12
View File
@@ -73,6 +73,15 @@ export function stableMainEntryFileName(chunk: {
: '[name].js'
}
// The renderer CSP has no font-src, so fonts fall back to default-src 'self'.
// Small fonts (e.g. KaTeX) must stay files rather than data: URLs, or Chromium
// refuses them. Other assets keep Vite's default inline threshold.
export function rendererAssetInlineLimit(
filePath: string
): false | undefined {
return /\.(?:woff2?|ttf|otf)(?:$|\?)/iu.test(filePath) ? false : undefined
}
export default defineConfig({
main: {
plugins: [
@@ -192,6 +201,9 @@ export default defineConfig({
worker: {
format: 'es'
},
build: {
assetsInlineLimit: rendererAssetInlineLimit
},
plugins: [react()]
}
})