Vite · Updated 2026-09-14 · Demox team

How do you deploy a Vite app?

Direct answer: Vite apps deploy to Demox as static files. Run npm run build. Then demox deploy ./dist. The default Vite outDir is dist. If you changed outDir, deploy that folder instead. Set base to ./ or / so assets load on the hosted origin. Do not upload the Vite source tree. MCP agents can run the build and the deploy. Client-side routing works as a static SPA. Server-side Vite plugins that need Node at request time are not included unless you rewrite them as handler(request, env).

How to do it

  1. Step 1. npm run build
  2. Step 2. Check dist/index.html and hashed assets.
  3. Step 3. demox deploy ./dist
  4. Step 4. Reload inner routes in a private window.

FAQ

What about Vite SSR?

Export a static build, or host the server elsewhere. Demox does not run the Vite dev server.

Environment variables?

Only VITE_ public variables belong in the frontend build. Secrets stay in function env.

Vite 项目怎么发布?

先 npm run build,再 demox deploy ./dist。资源 base path 按静态托管设置。不要上传源码。

按这个顺序做

  1. 01 npm run build
  2. 02 检查 dist/index.html 和带 hash 的资源。
  3. 03 demox deploy ./dist
  4. 04 用无痕窗口刷新内部路由。

常见问题

Vite SSR 怎么办?

先静态导出,或把服务放在别的地方。Demox 不跑 Vite 开发服务器。

环境变量呢?

只有 VITE_ 开头的公开变量能进前端构建。密钥放在函数 env。

Related Demox pages

Upload and publish · Read the docs