The best way to control Claude Code, Codex and more from any computer or phone

main
mdx 77 lines 2.2 KB
Raw
1 ---
2 title: Vue
3 description: Deploy a Vue single-page app to Cloud Run with GCP.Website.Vite — scaffold with create-vue, deep links answered by index.html.
4 sidebar:
5 order: 4
6 ---
7
8 import { Code, Tabs, TabItem } from "@astrojs/starlight/components";
9 import PackageManagers from "../../../../components/PackageManagers.astro";
10
11 export const devDeps = "@alchemy.run/frontend-frameworks";
12
13 A Vue app is a Vite app, so it deploys with
14 [`GCP.Website.Vite`](/gcp/frontend/vite). Vue Router's history mode
15 works out of the box: unknown paths answer with `index.html`.
16
17 ## Install
18
19 <PackageManagers dev={devDeps} />
20
21 Docker has to be running when you deploy.
22
23 ## Scaffold the app
24
25 <Tabs syncKey="pkgManager">
26 <TabItem label="pnpm" icon="pnpm">
27 <Code code={`pnpm create vite web --template vue-ts\ncd web && pnpm install && cd ..`} lang="sh" />
28 </TabItem>
29 <TabItem label="bun" icon="bun">
30 <Code code={`bun create vite@latest web -- --template vue-ts\ncd web && bun install && cd ..`} lang="sh" />
31 </TabItem>
32 <TabItem label="npm" icon="npm">
33 <Code code={`npm create vite@latest web -- --template vue-ts\ncd web && npm install && cd ..`} lang="sh" />
34 </TabItem>
35 <TabItem label="yarn" icon="seti:yarn">
36 <Code code={`yarn create vite web --template vue-ts\ncd web && yarn install && cd ..`} lang="sh" />
37 </TabItem>
38 </Tabs>
39
40 Keep the generated `vite.config.ts` as it is.
41
42 ## Deploy the site
43
44 ```typescript
45 // alchemy.run.ts
46 import * as Alchemy from "alchemy";
47 import * as GCP from "@alchemy.run/gcp";
48 import * as Effect from "effect/Effect";
49
50 export const Website = GCP.Website.Vite("Website", { rootDir: "./web" });
51
52 export default Alchemy.Stack(
53 "MyVueApp",
54 { providers: GCP.providers(), state: GCP.state() },
55 Effect.gen(function* () {
56 const site = yield* Website;
57 return { url: site.url };
58 }),
59 );
60 ```
61
62 ```sh
63 bun alchemy deploy
64 ```
65
66 When you add [Vue Router](https://router.vuejs.org) in history mode,
67 deep links work as they are: the server answers unknown paths with
68 `index.html`.
69
70 ## Local development
71
72 `alchemy dev` runs Vite's dev server with hot reload.
73
74 ## Where next
75
76 - [Vite](/gcp/frontend/vite) — env values, base paths, and 404 pages.
77 - [Nuxt](/gcp/frontend/nuxt) — when you need server rendering.