Skip to content

fix: broken build with new mermaid feature#63

Merged
this-is-tobi merged 1 commit intomainfrom
develop
Mar 16, 2026
Merged

fix: broken build with new mermaid feature#63
this-is-tobi merged 1 commit intomainfrom
develop

Conversation

@this-is-tobi
Copy link
Copy Markdown
Owner

Description

Fix the mermaid plugin integration that was causing a broken build after adding vitepress-plugin-mermaid support.

The root cause was that withMermaid() was previously called on the serialized VitePress config (via JSON.stringify), which silently dropped all functions and Vite plugins. A follow-up attempt using a generated import { withMermaid } with an absolute path in the output config was fragile (pnpm strict resolution, machine-specific store paths).

The fix moves the withMermaid call into the build command itself, using VitePress's public onAfterConfigResolve hook. This ensures mermaid is applied at docpress runtime where the import resolves correctly, and the generated config stays as pure serializable JSON.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

The fix is covered by unit tests in src/commands/build.spec.ts:

  • A new test verifies that withMermaid is called via onAfterConfigResolve with the resolved site config.
  • Existing tests updated to assert the new vitepressBuild call signature with the onAfterConfigResolve option.

Test Configuration:

  • Node.js (pnpm 10, vitest 4)
  • 215 tests pass (214 existing + 1 new)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Hey !

The security scan report for the current pull request is available here.

@this-is-tobi this-is-tobi merged commit 2641f36 into main Mar 16, 2026
16 checks passed
@this-is-tobi this-is-tobi deleted the develop branch March 16, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant