Vite
Source:
src/Railway/Website/Vite.ts
Deploy a plain Vite application to Railway: static
assets (the vite build output) served by a generated Node static-file
server on one Railway.Service. 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.
SSR frameworks that wrap Vite deploy through their own composites (Railway.Website.Astro, Railway.Website.SvelteKit, Railway.Website.Octane, …) — this composite never creates a framework server module.
Creating Vite Sites
Section titled “Creating Vite Sites”Basic Vite SPA
const site = yield* Railway.Website.Vite("Web");Project in a Subdirectory
const site = yield* Railway.Website.Vite("Web", { rootDir: "./app",});Existing Project
const project = yield* Railway.Project("Site");const site = yield* Railway.Website.Vite("Web", { project,});Multi-Page Sites
Section titled “Multi-Page Sites”const site = yield* Railway.Website.Vite("Docs", { assets: { notFoundHandling: "404-page" },});Build Configuration
Section titled “Build Configuration”const site = yield* Railway.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 Project or Service is created.const site = yield* Railway.Website.Vite("Web");