Switch rehype-mermaid to client-side rendering to fix Astro 6 OOM#10070
Draft
Switch rehype-mermaid to client-side rendering to fix Astro 6 OOM#10070
Conversation
…t-side rendering The rehype-mermaid plugin was using the default 'inline-svg' strategy which launches a headless Playwright/Chromium browser during build to render mermaid diagrams server-side. Combined with Astro 6's higher baseline memory usage, this caused OOM errors requiring an 8GB memory limit workaround. Changes: - Switch rehype-mermaid to 'pre-mermaid' strategy (no browser needed) - Add client-side mermaid.js script that only loads on pages with diagrams - Remove NODE_OPTIONS --max-old-space-size=8192 from build script Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [ISSUE-XXX] Investigate astro 6 extra memory usage
Switch rehype-mermaid to client-side rendering to fix Astro 6 OOM
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Astro 6 migration caused OOM during website builds. Root cause:
rehype-mermaiddefaults toinline-svgstrategy, which launches a headless Playwright/Chromium browser at build time to server-side render diagrams. Combined with Astro 6's higher baseline memory, this exceeded limits. There is exactly one mermaid diagram in the entire site.Changes
website/astro.config.mjs: Switchrehype-mermaidtopre-mermaidstrategy (no browser spawn). Add conditional client-side mermaid.js loader that only fetches the library on pages with diagrams:website/package.json: RemoveNODE_OPTIONS="--max-old-space-size=8192"workaround frombuild:webWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
telemetry.astro.build/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/bin/astro.mjs build sh tool�� ebsite/src/conte--llmstxt node pec/node_modules../../website/src/content/docs/docs/emitters/openapi3/reference ld.json && pnpm node grep /.bin/node sh /nod�� node scripts/generate-version.js sh de_modules/pnpm/dist/node-gyp-bin/sh ental ture tools/pnpm/10.30doc node(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.