Skip to content

Resolve @site partials via siteDir instead of process.cwd() - #57

Merged
rachfop merged 2 commits into
mainfrom
fix-site-alias-sitedir
Jul 17, 2026
Merged

rachfop merged 2 commits into
mainfrom
fix-site-alias-sitedir

Conversation

@rachfop

@rachfop rachfop commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Follow-up to #55 (the review fix that didn't make it into that merge).

What

Thread the site directory through processMarkdownFile into resolvePartialImports so @site/ alias imports resolve against the real site root, instead of assuming the build runs from process.cwd(). Falls back to process.cwd() when no siteDir is supplied (keeps standalone/test usage working).

Why

#55 resolved @site/ partials using process.cwd(), which is correct for a normal Docusaurus build but fragile if the build runs from a different cwd. The plugin already knows the true siteDir (context.siteDir) — this passes it down.

Test plan

Updates tests/test-site-alias-partials.js to run from a cwd that is not the site dir and pass siteDir explicitly, so it exercises the threaded argument rather than the cwd fallback. Full npm test passes.

rachfop added 2 commits July 17, 2026 09:38
Thread the site directory through processMarkdownFile into
resolvePartialImports so `@site/` alias imports resolve against the real
site root rather than assuming the build runs from process.cwd(). Falls
back to process.cwd() when no siteDir is supplied.

Update the @site partials test to run from a different cwd and pass
siteDir explicitly, so it exercises the threaded argument rather than the
cwd fallback.
@rachfop
rachfop marked this pull request as ready for review July 17, 2026 16:52
@rachfop
rachfop merged commit 2a33fca into main Jul 17, 2026
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