close
Skip to content

build: guard Docusaurus SSG against wildcard routes on Windows#2881

Open
hercial61 wants to merge 1 commit intoMetaMask:mainfrom
hercial61:upstream-pr/windows-ssg-patch
Open

build: guard Docusaurus SSG against wildcard routes on Windows#2881
hercial61 wants to merge 1 commit intoMetaMask:mainfrom
hercial61:upstream-pr/windows-ssg-patch

Conversation

@hercial61
Copy link
Copy Markdown

@hercial61 hercial61 commented Apr 24, 2026

Summary

  • npm run build crashes on Windows during static-site generation on any route whose path contains * (wildcard redirects, 404 fallbacks, etc.), because Windows rejects the generated filename.
  • Adds scripts/patch-docusaurus-windows-routes.js, which idempotently patches the installed @docusaurus/core routes module to filter wildcard paths out of the SSG list before build.
  • Prepends it to the build script so Windows contributors get a working npm run build out of the box, without affecting macOS/Linux runs.

Test plan

  • npm run build succeeds on Windows (previously failed with a filesystem error during SSG).
  • npm run build still succeeds on macOS and Linux.
  • Re-running npm install and then npm run build re-applies the patch cleanly (patch is idempotent).
  • On @docusaurus/core version bumps, the script should fail loudly if its expected needle text is no longer present — confirm by temporarily mutating the needle and re-running.

🤖 Generated with Claude Code


Note

Medium Risk
Medium risk because it mutates node_modules/@docusaurus/core at build time using a string-replacement patch that could fail or become stale on Docusaurus upgrades.

Overview
Fixes Windows npm run build failures during Docusaurus static-site generation by filtering out wildcard (*) route paths from the list of SSG routes.

This prepends a new, idempotent scripts/patch-docusaurus-windows-routes.js step to the build script that string-patches @docusaurus/core’s getRoutesPaths implementation and aborts loudly if the expected upstream file shape changes.

Reviewed by Cursor Bugbot for commit 85993cf. Bugbot is set up for automated code reviews on this repo. Configure here.

@hercial61 hercial61 requested review from a team as code owners April 24, 2026 06:04
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

@hercialvitalis21 is attempting to deploy a commit to the Consensys Team on Vercel.

A member of the Team first needs to authorize it.

`docusaurus build` fails on Windows during static generation on any
route whose path contains `*` (e.g. wildcard redirects or 404 fallbacks),
because the default filename gets rejected by the Windows filesystem.
`scripts/patch-docusaurus-windows-routes.js` patches the installed
`@docusaurus/core` routes module to filter those paths out of the SSG
list before build; the patch is idempotent and a no-op on non-Windows
runs, so it's safe to prepend to the existing build pipeline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants