Summary
We currently depend on several third-party Rspress plugins that are raw-copied or resolved at runtime by Rspress's webpack. This creates brittle build behavior — e.g. rspress-plugin-file-tree code-splits its output into chunk files (0~*.js) with hardcoded relative imports, forcing us to copy its entire dist/ into ours and risk clobbering our own build output (see rslib.config.ts 🚨 comment).
We should fork/internalize every third-party plugin we use so we fully control the build output, avoid chunk resolution issues, and can adapt components to our codebase conventions.
Plugins to internalize
Approach
For each plugin:
- Clone the source into
packages/ui/src/plugins/<name>/
- Adapt to our codebase conventions (functional TS, no classes, no ternaries, etc.)
- Bundle as part of our Rslib build (single file, no code splitting)
- Remove the
output.copy rules and node_modules dependency
- Register via
createRspressConfig the same way mermaidPlugin already works
Why
- Brittle builds: File-tree chunks must be copied to
dist/ root with glob exclusions to avoid clobbering index.mjs / index.d.ts — any change in the plugin's build output breaks us silently
- No control over code splitting: Plugin authors can change their Rslib config at any time, breaking our copy assumptions
- Convention mismatch: Third-party code doesn't follow our functional TS standards
- Mermaid precedent: We already internalized the mermaid plugin successfully — same pattern applies here
Acceptance criteria
Summary
We currently depend on several third-party Rspress plugins that are raw-copied or resolved at runtime by Rspress's webpack. This creates brittle build behavior — e.g.
rspress-plugin-file-treecode-splits its output into chunk files (0~*.js) with hardcoded relative imports, forcing us to copy its entiredist/into ours and risk clobbering our own build output (seerslib.config.ts🚨 comment).We should fork/internalize every third-party plugin we use so we fully control the build output, avoid chunk resolution issues, and can adapt components to our codebase conventions.
Plugins to internalize
rspress-plugin-file-treerspress-plugin-devkitrspress-plugin-katexrspress-plugin-supersubApproach
For each plugin:
packages/ui/src/plugins/<name>/output.copyrules andnode_modulesdependencycreateRspressConfigthe same waymermaidPluginalready worksWhy
dist/root with glob exclusions to avoid clobberingindex.mjs/index.d.ts— any change in the plugin's build output breaks us silentlyAcceptance criteria
packages/ui/src/plugins/rspress-plugin-file-tree,rspress-plugin-katex, orrspress-plugin-supersubinpackage.jsonoutput.copyrules referencingnode_modulesinrslib.config.tspnpm build && pnpm docs:buildpasses locally and on Vercel