Skip to content

fix(build): add @workspace/registry to transpilePackages - #6

Merged
codewizdave merged 2 commits into
mainfrom
fix/vercel-registry-source-transpile
Jul 29, 2026
Merged

fix(build): add @workspace/registry to transpilePackages#6
codewizdave merged 2 commits into
mainfrom
fix/vercel-registry-source-transpile

Conversation

@martyy-code

Copy link
Copy Markdown
Contributor

Problem

Vercel production runtime ENOENT when serving component pages:

Error: ENOENT: no such file or directory, open
"/var/task/packages/registry/src/components/button/index.tsx"
    at i (.next/server/chunks/ssr/[root-of-the-server]__0f~oin0._.js:1:5780)

The bundled apps/web output references the workspace registry source path. In dev mode this resolves correctly via the workspace symlink. In Vercel serverless, the registry source tree is not shipped as part of the deployed artifact (only the dist output is), so the runtime file open fails. The same pattern works fine for @workspace/ui because ui is already in transpilePackages — Next bundles its source directly into the next output.

Fix

Add @workspace/registry to transpilePackages in apps/web/next.config.ts. Next now transpiles the registry source files as part of the apps/web build, so the bundled code resolves the symbol inline rather than opening an external file at runtime.

 const nextConfig: NextConfig = {
-  transpilePackages: ["@workspace/ui"],
+  transpilePackages: ["@workspace/ui", "@workspace/registry"],
 }

Verified

  • cd apps/web && npx tsc --noEmit exits 0
  • Full production build npm run build -w apps/web succeeds (compile, typecheck, static page generation)

The pre-existing apps/web/package.json build chain — prebuild emits sources.generated.ts and apps/web/public/r/*.json, then npm run build -w @workspace/registry emits dist, then next build — keeps working unchanged. transpilePackages does not interfere with the dist build; it just makes Next prefer the source through its own pipeline instead of falling through to a runtime file open.

Out of scope

  • A future cleanup could drop the npm run build -w @workspace/registry step from apps/web/package.json since transpilePackages now makes it redundant. Holding off on that for this PR because the existing pipeline has been working and this change is only fixing the failure mode.

Generated with Claude Code

Vercel runtime error: ENOENT trying to open
/var/task/packages/registry/src/components/button/index.tsx
when serving /components/buttons.

Turbopack's workspace resolution for @workspace/registry was
following the source path at runtime (the same pattern that
works for dev mode is not safe in serverless production where
the source tree is not in the deployed artifact). Adding
@workspace/registry to transpilePackages tells Next to
transpile the registry source as part of the apps/web build,
so the runtime references are to bundled code rather than
external paths.

Verified locally: typecheck passes, full production build
succeeds. The pre-existing build pipeline (registry tsc +
apps/web prebuild + next build) keeps working — transpilePackages
does not interfere with the dist build, it just makes Next
prefer the source path through its own pipeline.

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ui-web Ready Ready Preview, Comment Jul 29, 2026 12:07pm

Follow-up to PR #5 (install-command on detail pages).

PR #5 added "bash" to the SupportedLang type in CodeBlock but did
not preload the bash grammar in apps/web/lib/shiki.ts. At runtime
Shiki threw:

    ShikiError: Language "bash" not found, you may need to load it first

on every render of a component detail page.

One-line fix: add "bash" to the langs array passed to
createHighlighter. Shiki lazy-loads grammars; this loads only when
getHighlighter() is first called, so there's no runtime overhead
beyond the one-time fetch.

Co-Authored-By: Claude <noreply@anthropic.com>
@martyy-code
martyy-code force-pushed the fix/vercel-registry-source-transpile branch from 4b6f612 to 6da22b6 Compare July 29, 2026 12:05
@codewizdave
codewizdave merged commit 38b02a2 into main Jul 29, 2026
8 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.

2 participants