<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jonathan Sherpa</title>
    <description>The latest articles on DEV Community by Jonathan Sherpa (@jonathancodes365).</description>
    <link>https://dev.to/jonathancodes365</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3960382%2F5c315e75-1663-441e-ae54-c70a3ed101b0.jpg</url>
      <title>DEV Community: Jonathan Sherpa</title>
      <link>https://dev.to/jonathancodes365</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jonathancodes365"/>
    <language>en</language>
    <item>
      <title>Deploying Lovable to Vercel — Cracked"</title>
      <dc:creator>Jonathan Sherpa</dc:creator>
      <pubDate>Sat, 30 May 2026 19:32:31 +0000</pubDate>
      <link>https://dev.to/jonathancodes365/deploying-lovable-to-vercel-cracked-kfo</link>
      <guid>https://dev.to/jonathancodes365/deploying-lovable-to-vercel-cracked-kfo</guid>
      <description>&lt;p&gt;🚀 Live demo: &lt;a href="https://urljourney.vercel.app" rel="noopener noreferrer"&gt;urljourney.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deploying Lovable + TanStack Start to Vercel kept throwing 404s and "No Output Directory" errors no matter what I tried. After hours of debugging, here's exactly what was wrong and the 2-file fix.&lt;/p&gt;

&lt;p&gt;What Lovable Generates:&lt;br&gt;
Lovable scaffolds projects using TanStack Start with Nitro as the server engine. This is a full-stack SSR framework, not a static site.&lt;br&gt;
That's the root cause of every Vercel deployment problem.&lt;/p&gt;

&lt;p&gt;Why It Fails Out of the Box&lt;br&gt;
Problem 1: Vercel expects public/ but gets nothing&lt;br&gt;
Vercel assumes a static site. TanStack Start + Nitro outputs a server bundle.&lt;br&gt;
So you get:&lt;br&gt;
No Output Directory named "public" found after the Build completed.&lt;/p&gt;

&lt;p&gt;Problem 2: Setting outputDirectory: "dist/client" gives 404&lt;br&gt;
Even after pointing Vercel to dist/client, every route returns 404. TanStack Start uses SSR — every route needs the Nitro server to handle it.&lt;br&gt;
 Without the server running, nothing works.&lt;/p&gt;

&lt;p&gt;Problem 3: The rewrite trick doesn't work&lt;br&gt;
Adding this to vercel.json:&lt;br&gt;
json{ "source": "/(.*)", "destination": "/dist/server/server.js" }&lt;br&gt;
...fails because dist/server/server.js is just an error logger, not the actual server entry.&lt;/p&gt;

&lt;p&gt;Problem 4: Vercel functions runtime syntax is wrong&lt;br&gt;
Trying "runtime": "nodejs20.x" throws:&lt;br&gt;
Function Runtimes must have a valid version, for example &lt;code&gt;now-php@1.0.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Problem 5: Default Nitro preset is Cloudflare, not Vercel&lt;br&gt;
The @lovable.dev/vite-tanstack-config comment in vite.config.ts says:&lt;/p&gt;

&lt;p&gt;"nitro (build-only using cloudflare as a default target)"&lt;/p&gt;

&lt;p&gt;A Vercel preset exists in Nitro but it's never used unless you explicitly set it. That's the real fix.&lt;/p&gt;

&lt;p&gt;The Fix (2 Files)&lt;br&gt;
Step 1: Update vite.config.ts&lt;br&gt;
tsimport { defineConfig } from "@lovable.dev/vite-tanstack-config";&lt;/p&gt;

&lt;p&gt;export default defineConfig({&lt;br&gt;
  tanstackStart: {&lt;br&gt;
    server: { entry: "server" },&lt;br&gt;
  },&lt;br&gt;
  nitro: {&lt;br&gt;
    preset: "vercel",&lt;br&gt;
    output: {&lt;br&gt;
      dir: ".vercel/output",&lt;br&gt;
      serverDir: ".vercel/output/functions/__server.func",&lt;br&gt;
      publicDir: ".vercel/output/static",&lt;br&gt;
    },&lt;br&gt;
  },&lt;br&gt;
});&lt;br&gt;
Step 2: Create vercel.json&lt;br&gt;
json{&lt;br&gt;
  "buildCommand": "npm run build",&lt;br&gt;
  "outputDirectory": ".vercel/output",&lt;br&gt;
  "framework": null&lt;br&gt;
}&lt;br&gt;
Step 3: Build and verify locally&lt;br&gt;
bashnpm run build&lt;br&gt;
ls .vercel/output/&lt;/p&gt;

&lt;h1&gt;
  
  
  Should show: config.json  functions/  static/  nitro.json
&lt;/h1&gt;

&lt;p&gt;Step 4: Commit and push&lt;br&gt;
bashgit add vite.config.ts vercel.json&lt;br&gt;
git commit -m "fix: use nitro vercel preset with prebuilt output"&lt;br&gt;
git push&lt;/p&gt;

&lt;p&gt;Why This Works&lt;br&gt;
Nitro's Vercel preset generates .vercel/output in Vercel's Build Output API v3 format:&lt;br&gt;
.vercel/output/&lt;br&gt;
  config.json              ← routing rules&lt;br&gt;
  static/                  ← static assets served by CDN&lt;br&gt;
  functions/&lt;br&gt;
    __server.func/&lt;br&gt;
      index.mjs            ← serverless function handling all SSR routes&lt;br&gt;
      .vc-config.json      ← tells Vercel this is a Node.js function&lt;br&gt;
Vercel natively understands this format and correctly wires up static asset serving + the serverless function. No manual rewrites needed.&lt;/p&gt;

&lt;p&gt;Starting Fresh on Lovable?&lt;br&gt;
Make these two changes before your first push and skip all of this pain.&lt;/p&gt;

&lt;p&gt;Common Mistakes to Avoid&lt;/p&gt;

&lt;p&gt;❌ Don't set outputDirectory: "dist" or "dist/client"&lt;br&gt;
❌ Don't add manual rewrites in vercel.json&lt;br&gt;
❌ Don't set framework: "vite" or any other framework&lt;br&gt;
❌ Don't skip the output.dir override in vite.config.ts&lt;br&gt;
✅ Always run npm run build locally first and verify .vercel/output/ exists before pushing&lt;/p&gt;

</description>
      <category>devops</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
