Skip to content

fix: resolve 'Module not found: fs' build error on Vercel#5

Merged
seanebones-lang merged 1 commit into
mainfrom
claude/enhance-system-agents-lk66U
Mar 17, 2026
Merged

fix: resolve 'Module not found: fs' build error on Vercel#5
seanebones-lang merged 1 commit into
mainfrom
claude/enhance-system-agents-lk66U

Conversation

@seanebones-lang
Copy link
Copy Markdown
Owner

Two changes to prevent Node.js 'fs' module from being bundled in client-side code:

  1. next.config.js: Add webpack resolve fallbacks for 'fs' and 'path' modules on the client side, providing empty stubs instead of failing.

  2. src/lib/agent-memory.ts: Use lazy require() for persistence module (already applied in previous commit), ensuring it's only loaded server-side behind typeof window checks.

The import chain causing the error:
ChatPane.tsx → agent-memory.ts → persistence.ts → fs (Node.js)
CommandPalette.tsx → agent-memory.ts → persistence.ts → fs (Node.js)

https://claude.ai/code/session_01EgmjHaEN3MdD47o3BgynKV

Two changes to prevent Node.js 'fs' module from being bundled in
client-side code:

1. next.config.js: Add webpack resolve fallbacks for 'fs' and 'path'
   modules on the client side, providing empty stubs instead of failing.

2. src/lib/agent-memory.ts: Use lazy require() for persistence module
   (already applied in previous commit), ensuring it's only loaded
   server-side behind typeof window checks.

The import chain causing the error:
  ChatPane.tsx → agent-memory.ts → persistence.ts → fs (Node.js)
  CommandPalette.tsx → agent-memory.ts → persistence.ts → fs (Node.js)

https://claude.ai/code/session_01EgmjHaEN3MdD47o3BgynKV
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 17, 2026

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

Project Deployment Actions Updated (UTC)
grokcode Ready Ready Preview, Comment Mar 17, 2026 11:45pm

Request Review

@seanebones-lang seanebones-lang merged commit cec5676 into main Mar 17, 2026
2 checks passed
@seanebones-lang seanebones-lang deleted the claude/enhance-system-agents-lk66U branch March 17, 2026 23:45
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