HOSTING

Share a Vite or React app as a single HTML file

vite-plugin-singlefile builds a Vite app, including React, Vue and Svelte projects, into one index.html with the JavaScript, CSS and imported images inside it. Upload that file and send a link that runs the app in any browser.

5 min read·

npm run build in a Vite project writes a dist folder: index.html plus an assets folder of hashed .js and .css files. Sending that folder means asking someone to unzip it and run a local server, and opening dist/index.html straight from disk usually shows a blank page. A Vite app built into one HTML file avoids both, and a hosted link opens it like any web page. AI coding tools often scaffold Vite projects, so this also covers sharing an app your AI built.

Build the app into one file

  • ✓Install the plugin: npm install -D vite-plugin-singlefile.
  • ✓In vite.config.js (or .ts), import { viteSingleFile } from "vite-plugin-singlefile" and add viteSingleFile() to the plugins array, after the framework plugin such as react().
  • ✓Run npm run build. dist/index.html now holds the bundled JavaScript and CSS inline, including chunks from dynamic import().
  • ✓Images and fonts you import from src are written into the file as data URIs, whatever their size.

What stays outside the file

Files in the public folder are copied next to index.html, not inlined. A favicon or an image referenced as /logo.png will be missing once only index.html is hosted. Move those files into src and import them, or load them from a full https:// URL.

Calls to an API on localhost will fail for everyone but you. Point them at a public API, or bake the data into the build as a JSON import.

Anything in a VITE_ environment variable is written into the JavaScript and readable by anyone who opens the page. Keep secret keys out of a front-end build.

Routing

A router that reads the address path, such as React Router's BrowserRouter, sees the share link's path rather than / and may render a not-found page. A hash router (createHashRouter or HashRouter in React Router, createWebHashHistory in Vue Router) keeps routes after the # and works from a single file.

Upload it and send the link

Drag dist/index.html onto the FileShare Pro dashboard and copy the link. The free plan accepts files up to 100 MB. Open the link yourself before sending it, and check the browser console for requests to files that were not inlined.

Viewers need no account and nothing to install. Shared pages carry a noindex tag, so a prototype does not appear in search results. On Pro you can add a password: password-protecting an HTML page.

Update the app without a new link

After a change, build again and upload the new index.html over the old one. The link stays the same and the previous version is kept in history: updating a shared link without changing it.

Turn on comments and testers can leave a note on the page after typing a name. The view count shows whether the person you sent it to has opened it. To publish from Claude Code without the dashboard, see publishing HTML from Claude Code.

Frequently asked

How do I build a Vite app into a single HTML file?

Install vite-plugin-singlefile, add viteSingleFile() to the plugins in vite.config, and run npm run build. dist/index.html then contains the JavaScript, CSS and imported assets.

Why does dist/index.html show a blank page when I open it?

A normal Vite build loads its scripts from the assets folder as modules, which browsers block on a file opened from disk. A single-file build, served from a link, avoids that.

Why are my images missing after the single-file build?

They are probably in the public folder, which the plugin does not inline. Move them into src and import them, or use full https:// URLs.

Does this work for React, Vue and Svelte?

Yes. The plugin works on Vite's build output, so any framework that builds with Vite can use it. Use a hash router if the app has more than one route.

Is it free?

Yes. The free plan hosts up to 50 files of up to 100 MB each, with view counts and comments included. Password-protected links are on Pro.

Got a page to share?

Drop the file, copy the link — live in seconds, free plan included.

Start sharing free