Skip to content

refactor(website): client-safe SITE_ORIGIN leaf module#577

Merged
blove merged 3 commits into
mainfrom
claude/docs-site-origin
Jun 5, 2026
Merged

refactor(website): client-safe SITE_ORIGIN leaf module#577
blove merged 3 commits into
mainfrom
claude/docs-site-origin

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented Jun 5, 2026

Summary

Fix the root cause behind the PageActions inline workaround: lib/site-metadata.ts transitively imports lib/blog.ts (import fs from 'fs'), so it can't be imported from any 'use client' component (breaks the client bundle with "Module not found: Can't resolve 'fs'").

  • Add leaf module apps/website/src/lib/site-origin.ts exporting just SITE_ORIGIN (no fs-tainted imports).
  • site-metadata.ts now re-exports SITE_ORIGIN from it (server importers like layout.tsx and blog/rss.xml/route.ts are unaffected).
  • PageActions.tsx imports from the leaf module and drops the inline duplicate + keep-in-sync comment.

Test Plan

  • PageActions.spec.tsx — 2/2
  • e2e/docs.spec.ts — 8/8
  • eslint on changed files — clean
  • /docs/langgraph/guides/streaming returns HTTP 200 (client bundle compiles, no fs error)
  • CI green

🤖 Generated with Claude Code

site-metadata.ts transitively imports lib/blog (Node fs), so it can't be
imported from 'use client' components. Extract SITE_ORIGIN into a leaf
module (site-origin.ts) with no fs-tainted imports; re-export it from
site-metadata; import it in PageActions instead of the inline duplicate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jun 5, 2026 7:30pm

Request Review

A bare `export { SITE_ORIGIN } from './site-origin'` re-export creates no
local binding, but getCanonicalUrl() uses SITE_ORIGIN internally — `next
build` failed with "Cannot find name 'SITE_ORIGIN'". Import then export.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@blove blove merged commit d21729d into main Jun 5, 2026
19 checks passed
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