How to Deploy a Vue App for Free (Vite or Vue CLI)
This guide shows how to deploy a Vue app for free on LaunchPad, Hostmargin's static site hosting. It works for projects made with Vite (npm create vue@latest) and with the older Vue CLI. You'll get a live HTTPS address, and every git push redeploys the site automatically.
Before you start
- Your Vue project in a GitHub or GitLab repository (public or private).
- A free Hostmargin account to sign in to LaunchPad.
- A build that passes on your machine:
npm installthennpm run build. Both Vite and Vue CLI write the finished site todist.
Step 1: Push your code
git add .
git commit -m "Ready to deploy"
git push origin main
Step 2: Create the project
- Sign in at launchpad.hostmargin.com and click New project.
- Choose GitHub or GitLab, paste the repository URL and enter your branch (usually
main). - For a private repository, tick This is a private repository and add the read-only deploy key LaunchPad shows you.
Step 3: Use the Vue preset
Pick Vue (Vite) on the build settings step:
| Setting | Value |
|---|---|
| Build command | npm run build |
| Output directory | dist |
The same settings work for Vue CLI. LaunchPad installs dependencies from your lockfile and chooses the Node.js version for you. Projects on Vue CLI 4 or older build on Node 16 automatically, because their tooling doesn't run on newer Node.
Step 4: Pick an address and deploy
Choose a free subdomain, then click Create & Deploy. Follow the pipeline live: clone, install, build, copy, live. When the status shows Live, your Vue app is online with free SSL.
Step 5: Turn on auto-deploys
Copy the webhook URL and secret from the project's Settings tab into your repository's webhook settings. After that, every push to your branch rebuilds and republishes the site.
Vue Router and other gotchas
History mode works on refresh
Unknown paths fall back to index.html, so Vue Router in createWebHistory() mode works when someone refreshes a page or opens a deep link. You don't need hash URLs.
Vue CLI: keep publicPath at "/"
If vue.config.js sets publicPath to a sub-folder (common after hosting on GitHub Pages), your assets will 404. Set it back to "/":
// vue.config.js
module.exports = {
publicPath: '/',
}
Vite: keep base at "/"
The same applies to base in vite.config.js. Leave it at the default unless you know you need a sub-path.
The build times out
Projects made with npm create vue@latest and TypeScript run a type check as part of npm run build. On large projects that can take a while. If the build log shows it's the slow part, change the build command in Settings to npx vite build. Type-checking doesn't change the files you deploy; keep it in your editor or CI.
Environment variables
Vite only exposes variables that start with VITE_, and they end up in the browser. Never put secret keys in a front-end build.
Next steps
- Add your own domain with free SSL from the Domains page. See custom domains in the docs.
- Read the Vue section of the LaunchPad docs.
- Questions about plans and limits? See the FAQ.