perf(dashboard): reduce bundled font and diagram assets (#10034)

This commit is contained in:
Soulter
2026-09-10 23:04:59 +08:00
committed by GitHub
parent 5cc5617233
commit c6eefb5544
+12 -4
View File
@@ -61,6 +61,18 @@ export default defineConfig(({ command }) => ({
// Only run MDI subsetting during production builds, skip in dev server
...(command === 'build' ? [mdiSubset()] : []),
t2iShikiRuntimeAsset(),
{
name: 'katex-woff2-only',
enforce: 'pre',
transform(source, id) {
if (!/\/katex\/dist\/katex(?:\.min)?\.css$/.test(id.split('?')[0])) return;
// Keep one font format per face instead of shipping three identical glyph sets.
return source.replace(/src:[^;}]+/g, (declaration) => {
const woff2 = declaration.match(/url\([^)]*\.woff2\)\s*format\(["']woff2["']\)/);
return woff2 ? `src:${woff2[0]}` : declaration;
});
},
},
vue({
template: {
compilerOptions: {
@@ -83,10 +95,6 @@ export default defineConfig(({ command }) => ({
find: /^stream-monaco$/,
replacement: fileURLToPath(new URL('./src/utils/streamMonacoDisabled.js', import.meta.url))
},
{
find: 'mermaid',
replacement: 'mermaid/dist/mermaid.js'
},
{
find: '@',
replacement: fileURLToPath(new URL('./src', import.meta.url))