Bolt or Vite deploy used the wrong output directory
A Bolt or Vite build finished, but the host published build or .next instead of dist. Point the output directory at the folder that actually contains index.html.
Updated 2026-10-15
The build command exits 0, and the URL is still wrong. Sometimes Vercel says it could not find the output directory after the build. Sometimes the deployment goes Ready and the URL is a generic 404, or a Next.js 404, even though you never wrote a Next app. Bolt and Lovable export Vite projects. Vite writes the site to dist. The host was told to publish build or .next instead.
See which folder the build actually created
On your machine, from the directory that contains the app's package.json, run the same build the host runs. That is usually npm run build, and the script is vite build. When it finishes, Vite prints the files it emitted. The default build.outDir is dist, relative to the Vite project root. Look for dist/index.html and a dist/assets folder of hashed JavaScript and CSS.
If vite.config.ts sets build.outDir, that string replaces the default. Read it before you change the host. A config that says outDir: "build" is valid, and then the host must say build too. Guessing dist in that repo publishes an empty directory.
import { defineConfig } from "vite"
import react from "@vitejs/plugin-react"
export default defineConfig({
plugins: [react()],
// Omit build.outDir to keep Vite's default, dist.
})Three names get mixed up because import wizards reuse them:
distis Vite, which is what Bolt and a standard Lovable frontend emit.buildis Create React App. Pointing a Vite project atbuildpublishes a folder the build did not create..nextis Next.js. It is not a static export folder. A Vite preset left on the Next.js framework setting makes Vercel look there, or runnext build, which this repo cannot satisfy.
Point Vercel or Netlify at that folder
On Vercel, open the project, then Settings, then Build and Deployment:
- Framework Preset: Vite. If it says Next.js, change it. The preset chooses the build command and the output directory together.
- Build Command:
npm run build, or whateverpackage.jsonuses, as long as it runsvite build. Do not leavenext buildin place. - Output Directory: the folder you just opened, usually
dist. No leading slash, and notdist/index.html. The value is the directory. - Root Directory: leave it as the repo root if
package.jsonis there. If the Vite app is in a subfolder, set Root Directory to that subfolder. Otherwise Vercel runs the build at the repo root, finds no Vite app or the wrong one, and looks fordistin the wrong place.
Save and redeploy. Project settings apply to the next build, not to a deployment that already published the wrong folder.
On Netlify, Site configuration, then Build and deploy, then Build settings: build command npm run build, publish directory dist. The publish directory is the same idea as Vercel's output directory. A publish directory of build or . ships the source tree or an empty CRA folder. The SPA _redirects file only works if it was copied into this publish directory. Vite does that when the file lives in public/. See the refresh 404 guide after the home page itself loads.
Cloudflare Pages asks for a build command and a build output directory. Use dist unless outDir says otherwise. The output directory is relative to the root you configured, not to your laptop's home folder.
Read the log against the folder
- Run
npm run buildlocally and confirmindex.htmlis inside the directory you will publish. Open that file and check that it references/assets/...scripts that exist beside it. - In the host log, find the output or publish directory it used. It should be that same folder. A line that mentions
.nexton a Vite repo means the preset is still Next.js. - If the log says the output directory was not found after the build, the build wrote somewhere else, or Root Directory is wrong so the relative path
distdoes not exist from where the builder looked. - When a deployment is Ready, request the URL. View source. You want your
index.html, with your title or an emptydiv id="root", not the platform's 404 page. A platform 404 with a green build is the wrong folder. Your own app 404 only on client routes is the rewrite, and only shows up once this part is fixed. - If the HTML is correct and the screen is white, the files are published and the client is throwing. Continue with missing VITE_ variables. If the build never gets that far and the log names
@rollup/rollup-linux-x64-gnu, the output directory is not the blocker yet.
Changing the output directory does not rewrite old URLs by itself. After you save the setting, the next deployment has to build again. Promoting an older deployment brings the old folder back.
Questions that come up next
What is the default output folder for Vite, Bolt, and Lovable?
Vite's build.outDir defaults to dist, relative to the project root. Bolt and Lovable apps are Vite apps unless the repo has changed that option. Create React App publishes build. Next.js publishes .next, which is a server build, not a folder of static HTML you can point at a Vite app.
The build log says success, but the URL is a platform 404. Is that the output directory?
Often, yes. The build command can finish and write dist/index.html while the host is configured to publish .next or build. It then deploys an empty or unrelated folder. Open the build log and compare the directory it published with the directory that contains index.html on your machine after npm run build.
I set dist and routes still 404 when I refresh. Did the output setting fail?
If the home page renders, the output directory is right enough to serve index.html. Refresh 404s on other paths are the SPA rewrite, covered separately. An output-directory miss fails the home page too, or fails the deployment before a URL exists.