Skip to content

fix(ui): fumadocs-mdx collections/* virtual modules missing on a fresh checkout #6304

Description

@oktofeesh1

Context

apps/loopover-ui/tsconfig.json maps collections/* to ./.source/*, a directory fumadocs-mdx's Vite plugin generates from source.config.ts. .source/ is gitignored and nothing in the repo currently generates it outside of an actual vite dev/vite build run.

npm run ui:typecheck (and therefore npm run test:ci's validate-code/validate CI jobs) runs bare tsc --noEmit with no prior Vite invocation, so on a genuinely fresh checkout (npm ci + no dev/build run yet) collections/browser/collections/server fail to resolve:

error TS2307: Cannot find module 'collections/browser' or its corresponding type declarations.
error TS2307: Cannot find module 'collections/server' or its corresponding type declarations.

This has been silently broken since the fumadocs-mdx docs migration landed in PR #6271 -- that PR's own CI (validate/validate-code) failed for this exact reason and it was merged by a maintainer override, not through the normal green-CI gate path. Every PR touching apps/loopover-ui since has been hitting this on a fresh CI runner even when local test:ci passes (a working tree with any prior local vite dev/build run masks it, since .source/ persists on disk once generated).

Fix

fumadocs-mdx's own CLI (node_modules/fumadocs-mdx/bin.js, published as the fumadocs-mdx bin) runs exactly this generation step standalone, without needing a full Vite dev/build -- it's designed to run as an npm postinstall hook. Wire it as apps/loopover-ui/package.json's postinstall script so npm ci (root or workspace) always regenerates .source/ before any other script (typecheck, lint, build) runs.

Validation

Verified locally: rm -rf apps/loopover-ui/.source && npm install --workspaces --if-present regenerates all four .source/* files via the new postinstall hook, and npm --workspace apps/loopover-ui run typecheck then passes cleanly (it failed before the fix, matching CI's exact error).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions