Skip to content

Move zod to dependencies - #2

Merged
andreasmcdermott merged 1 commit into
mainfrom
amcd/move-zod-to-dependencies
Aug 12, 2026
Merged

Move zod to dependencies#2
andreasmcdermott merged 1 commit into
mainfrom
amcd/move-zod-to-dependencies

Conversation

@andreasmcdermott

Copy link
Copy Markdown
Owner

Problem

A user installing from git hits a build failure:

Error: HTTP 422: install failed: server bundle build for "shortcut" failed:
Build failed with 1 error:
.../server.ts:2:18: ERROR: Could not resolve "zod"

Root cause

server.ts imports zod for the rpcContract schemas (lines 9–85), which are runtime zod objects, not type-only. bb plugin build bundles zod into dist/server.js (it is marked // node_modules/zod/v4/classic/external.js in the bundle) — zod is not externalized to bb's runtime.

zod was listed in devDependencies. bb's git-plugin install runs a production-only npm install --omit=dev, so node_modules/zod is absent in the staging cache and esbuild cannot resolve the import.

Fix

Move zod from devDependencies to dependencies — it is a genuine runtime dependency of the server bundle.

Verification

  • npm install --omit=devnode_modules/zod now present ✅ (this is the exact scenario that failed for the other user)
  • npm run typecheck
  • npm test ✅ (18 tests, 3 files)
  • npm run build (bb plugin build) ✅
  • Rebuilt dist/server.js still bundles zod inline, so managed installs using the committed artifacts remain self-contained.

Notes

  • dist/ artifacts are unchanged by this move (zod was already bundled there), so no artifact commit is needed.
  • package-lock.json also drops some libc fields — that's npm normalizing optional-dep metadata on this newer npm version; unrelated to the fix but harmless and kept.

server.ts imports zod at runtime (the rpcContract schemas are real
zod objects), and bb plugin build bundles zod into dist/server.js
rather than externalizing it. With zod listed as a devDependency,
bb's git-plugin install does a production-only npm install
(--omit=dev), so node_modules/zod is absent and the server bundle
build fails:

  ERROR: Could not resolve "zod"

Move zod to dependencies so production installs include it. Verified
that node_modules/zod now exists after `npm install --omit=dev`, and
that typecheck + 18 tests + bb plugin build all pass.
@andreasmcdermott
andreasmcdermott merged commit 98e868a into main Aug 12, 2026
2 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