import { Code, Tabs, TabItem } from "@astrojs/starlight/components";
import PackageManagers from "../../../../components/PackageManagers.astro"; export const devDeps = "@alchemy.run/frontend-frameworks"; A Vue app is a Vite app, so it deploys with
GCP.Website.Vite. Vue Router's history mode
works out of the box: unknown paths answer with index.html.
Install
Docker has to be running when you deploy.
Scaffold the app
<Code code={`pnpm create vite web --template vue-ts\ncd web && pnpm install && cd ..`} lang="sh" /> <Code code={`bun create vite@latest web -- --template vue-ts\ncd web && bun install && cd ..`} lang="sh" /> <Code code={`npm create vite@latest web -- --template vue-ts\ncd web && npm install && cd ..`} lang="sh" /> <Code code={`yarn create vite web --template vue-ts\ncd web && yarn install && cd ..`} lang="sh" />Keep the generated vite.config.ts as it is.
Deploy the site
// alchemy.run.ts
import * as Alchemy from "alchemy";
import * as GCP from "@alchemy.run/gcp";
import * as Effect from "effect/Effect";
export const Website = GCP.Website.Vite("Website", { rootDir: "./web" });
export default Alchemy.Stack(
"MyVueApp",
{ providers: GCP.providers(), state: GCP.state() },
Effect.gen(function* () {
const site = yield* Website;
return { url: site.url };
}),
); bun alchemy deploy When you add Vue Router in history mode,
deep links work as they are: the server answers unknown paths with
index.html.
Local development
alchemy dev runs Vite's dev server with hot reload.