fix(docs): pre-bundle mermaid deps so the dev server resolves dayjs/cytoscape #157

Merged
julien merged 1 commits from fix/docs-site-mermaid-dayjs-esm into main 2026-05-15 20:03:30 +02:00

1 Commits

Author SHA1 Message Date
Julien Gautier 44f8faca5d fix(docs): pre-bundle mermaid deps so the dev server resolves dayjs/cytoscape
CI / scan (pull_request) Failing after 2m25s
CI / commits (pull_request) Successful in 2m31s
CI / check (pull_request) Successful in 2m40s
CI / a11y (pull_request) Successful in 1m56s
Docs site / build (pull_request) Successful in 2m41s
CI / perf (pull_request) Successful in 4m51s
`pnpm docs:dev` rendered a blank page with `does not provide an
export named 'default'` thrown from dayjs.min.js. Mermaid 11 ships
its `dayjs`, `cytoscape`, `debug` and `@braintree/sanitize-url`
dependencies with a CommonJS `main` field but no `default` ESM
export. Vite's dev server resolves those modules eagerly as ESM
and the browser throws on the first navigation.

The production build (`docs:build`) was unaffected — Rollup's
plugin pipeline already applies the CJS→ESM interop wrapper. This
fix is exclusively for the dev happy path: `optimizeDeps.include`
forces Vite to pre-bundle the Mermaid dependency tree, which
applies the same interop shim at dev-server boot.

Caught by manual smoke of the merged docs-site chantier — the
build-time Mermaid-rendering fence in `.gitea/workflows/docs-site.yml`
didn't catch this because it only inspects production HTML.
2026-05-15 20:01:28 +02:00