Skip to content

Nitro Bun preset fails on Vercel (dist missing) while plain Nitro crashes at runtime #3806

Description

@vdmkotai

Environment

Environment

  • Bun 1.3.2
  • Vercel project using Bun runtime
  • Nitro ^3.0.1-alpha.1, TanStack React Start ^1.132.31, Vite ^7.0.2
  • Deployment URL example: <your-deployment-url>
  • Logs show internal error right after [env] VITE_SERVER_URL resolved … (no additional stack trace).

Reproduction

  1. Repo configured with:

    • Scripts

      {
      "dev": "bun --bun vite dev",
      "build": "bun --bun vite build",
      "serve": "bun --bun vite preview"
      }

      • Vite config

      export default defineConfig({
      plugins: [
      tsconfigPaths(),
      tailwindcss(),
      tanstackStart(),
      nitro({ preset: "bun" }),
      viteReact(),
      ],
      });
      2. Push to Vercel (Bun runtime).

  2. Build fails with “dist directory not found”. If I remove { preset: "bun" }, build succeeds but runtime 500s when Vercel starts the server.

Describe the bug

Summary
I’m running a TanStack React Start app with Vite and Nitro.

This is an app I'm trying to deploy (with my neon db an redis configured):
https://github.com/vdmkotai/tanstack-faster

When I run the Vite scripts via Bun (bun --bun vite dev|build|preview) using plain nitro() in vite config - everything builds but the serverless runtime on Vercel crashes immediately.

If I switch Nitro to nitro({ preset: "bun" }) the Vercel build itself crashes saying it can’t find dist folder

Meanwhile, everything works perfectly on Railway.

Additional context

Additional Context

  • Manually switching Vercel’s output folder to .output didn’t help.
  • Railway deployments (Node runtime) work fine with the same code.

Logs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions