Vite
Source:
src/Fly/Website/Vite.ts
Deploy a plain Vite application to Fly: a Service
serving the vite build output from a tiny static-file server. For
client-only projects — React/Vue/Solid SPAs, index.html multi-page
apps — whose entire deployable output is static assets.
The build runs through @alchemy.run/frontend-frameworks/vite with the
@alchemy.run/frontend-frameworks/vite/node deploy target — the package
must be installed in your project. Your project’s own vite.config.*
(plugins included) drives the build.
During alchemy dev the site is Vite’s own dev server (native HMR) and
no cloud resources are created — the site’s url is the dev server’s
local address. Alchemy.remote() opts back into the full deployment.
Creating Vite Sites
Section titled “Creating Vite Sites”Basic Vite SPA
const site = yield* Fly.Website.Vite("Web");Project in a Subdirectory
const site = yield* Fly.Website.Vite("Web", { rootDir: "./app",});Existing App
const site = yield* Fly.Website.Vite("Web", { app: Site });Multi-Page Sites
Section titled “Multi-Page Sites”const site = yield* Fly.Website.Vite("Docs", { assets: { notFoundHandling: "404-page" },});Custom Domain
Section titled “Custom Domain”const site = yield* Fly.Website.Vite("Web", { domain: "app.example.com",});Build Configuration
Section titled “Build Configuration”const site = yield* Fly.Website.Vite("Docs", { vite: { outDir: "build", base: "/docs/" },});Local Development
Section titled “Local Development”// `alchemy dev` starts `vite` programmatically: site.url is the local// dev server (HMR included); no Fly App or Service is created.const site = yield* Fly.Website.Vite("Web");