Websites2 minutes to read

Which files do I upload to host a Vite React app?

Choose between uploading a local Vite build and deploying React source from GitHub. Match the output index, asset paths and build command to the hosting profile.

Start with the production output

For a client-rendered React app built with Vite, upload the contents of the production build, including its index and assets. Vite usually writes these to dist/. On Bothosting, keep that directory intact and set MAIN_FILE=dist/index.html in a Static site deployment. A project that renders React on the server for each incoming request also needs that server process.

On your computer, install the dependencies recorded in your npm lockfile and run your project’s build script. Open the generated index in a text editor. If it refers to /assets/index-Ab12.js, that file should be inside dist/assets/. The generated filename will vary. Upload the entire output directory together so the index and its asset names belong to the same build.

When should the host build from source?

Choose Built frontend when you want a connected branch to supply the source. Include package.json, the lockfile, source code and build configuration. The default command runs npm ci followed by npm run build. If your configuration changes Vite’s output directory to web-output, use web-output/index.html as the entry.

Compiling locally is useful when the compiler’s peak memory exceeds your hosting allocation. Building on the host is useful when the deployed version needs to follow a shared release branch. See the Bothosting build settings and Vite’s deployment guide.

Trace one generated file after publishing

In Deploy, publish the website and open its platform URL. In the browser’s Network panel, reload the page and select the JavaScript request referenced by the current index. It should return JavaScript with a successful status. An HTML response or a 404 for that request points to a missing asset or a base path that differs from where you published the files. Fix the path or the build, then republish the full output. If the assets load but a direct visit to a nested page fails, check the single-page app fallback.