From 021ef7fc79bbebfd26d99b53db7373efa657bfbe Mon Sep 17 00:00:00 2001 From: liangxu Date: Mon, 27 Apr 2026 09:07:57 +0800 Subject: [PATCH] perf(admin-web): drop KaTeX fonts from editor bundle Import individual Crepe common stylesheets instead of the aggregate, which transitively pulled in latex.css and emitted ~59 KaTeX font files even though CrepeFeature.Latex is disabled. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/components/ArticleEditorCanvas.vue | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/admin-web/src/components/ArticleEditorCanvas.vue b/apps/admin-web/src/components/ArticleEditorCanvas.vue index a1cebfd..aa18f0f 100644 --- a/apps/admin-web/src/components/ArticleEditorCanvas.vue +++ b/apps/admin-web/src/components/ArticleEditorCanvas.vue @@ -50,7 +50,23 @@ import { import type { Ctx } from "@milkdown/kit/ctx"; import { callCommand, replaceAll } from "@milkdown/kit/utils"; import { Crepe, CrepeFeature } from "@milkdown/crepe"; -import "@milkdown/crepe/theme/common/style.css"; +// NOTE: import each common stylesheet explicitly instead of the aggregate +// `theme/common/style.css`. The aggregate transitively `@import`s `latex.css`, +// which pulls in `katex/dist/katex.min.css` and emits ~59 KaTeX font files +// into dist/assets/fonts even though we disable CrepeFeature.Latex. We don't +// render math, so skip latex.css to drop the fonts from the bundle. +import "@milkdown/crepe/theme/common/prosemirror.css"; +import "@milkdown/crepe/theme/common/reset.css"; +import "@milkdown/crepe/theme/common/block-edit.css"; +import "@milkdown/crepe/theme/common/code-mirror.css"; +import "@milkdown/crepe/theme/common/cursor.css"; +import "@milkdown/crepe/theme/common/image-block.css"; +import "@milkdown/crepe/theme/common/link-tooltip.css"; +import "@milkdown/crepe/theme/common/list-item.css"; +import "@milkdown/crepe/theme/common/placeholder.css"; +import "@milkdown/crepe/theme/common/toolbar.css"; +import "@milkdown/crepe/theme/common/table.css"; +import "@milkdown/crepe/theme/common/top-bar.css"; import "@milkdown/crepe/theme/frame.css"; import { computed,