Repository navigation
perf(frontend): keep Milkdown out of the desktop shell closure (WI-2144) - #523
Conversation
|
Size Change: 0 B 🆕 Total Size: 0 B |
|
Reviewed head P2 — Static-import parsing skips valid minified identifiers containing
|
|
Re-review: GitHub still shows head Previous reproduction and validation results still apply. Build and tests were not rerun because there are no new commits to validate. |
|
Fixed the P2 finding in Regression coverage is pushed to companion test PR Windshiftapp/core-tests-internal#58 ( Validation (Node 24.18.0, selected by
Full frontend, browser, Go, and PostgreSQL suites were not run; this follow-up only changes the build-time import guard and its unit coverage. Both branches were pushed successfully to origin. |
Summary
milkdownmanual-chunk group now setsincludeDependenciesRecursively: false, so the shared DOMPurify dependency used by the always-loaded sanitizer is no longer absorbed into the editor chunk.scripts/check-entry-assets.jsto walk the desktop shell's static import closure, fail if an optional library appears there, and budget the complete closure.WI-2144.
Root cause
@milkdown/componentsdepends ondompurify. With the default recursive grouping, DOMPurify was emitted inside themilkdown-*.jschunk.sanitize.ts(imported bysso.js→MainApp) imports DOMPurify, so the desktop shell's static closure included the whole editor chunk.Measurement
Built with
bun --bun run build:app; MainApp static closure:milkdown-*.js.Guard
check-entry-assets.jsnow walks static imports from theMainApp-*.jschunk (dynamic imports are not followed), fails on Excalidraw/Mermaid/Cytoscape/Milkdown/React/SvelteFlow/D3 in that closure, and enforces a closure budget. Run against the pre-fix build it fails withMilkdown: ./milkdown-DN-kA6qv.js; against the fixed build it passes.Validation
bun --bun run build:app: passes; the entry-asset check reports the desktop shell closure (228 chunks, ~1006 KiB raw / ~357 KiB gzip).bun --bun x biome check scripts/check-entry-assets.js vite.config.js: passes.src/lib/utils/sanitize.test.ts src/lib/editors).Windshiftapp/core-tests-internal, branchfeat/wi-2144-milkdown-closure.Go/PostgreSQL and browser suites were not run: no backend, schema or browser behavior changed.