| 1 | # AWS Website: Vite |
| 2 | |
| 3 | Deploys a [Vite](https://vite.dev) React SPA to AWS with |
| 4 | `AWS.Website.Vite` — static assets (the `vite build` output) in S3 |
| 5 | behind a CloudFront distribution. No server function is created; the |
| 6 | page renders entirely in the browser. |
| 7 | |
| 8 | - `src/main.tsx` mounts the React app into `index.html`. |
| 9 | - Tailwind CSS v4 is wired through `@tailwindcss/vite` in the project's |
| 10 | own `vite.config.ts`, which Alchemy loads natively — plugins included. |
| 11 | - `spa` defaults on, so unmatched paths answer with the index page. |
| 12 | |
| 13 | The integration package must be installed in the project (it is loaded |
| 14 | dynamically at deploy time): |
| 15 | |
| 16 | ```sh |
| 17 | bun add -d @alchemy.run/frontend-frameworks |
| 18 | ``` |
| 19 | |
| 20 | ## Deploy |
| 21 | |
| 22 | ```sh |
| 23 | bun install |
| 24 | bun run deploy |
| 25 | ``` |
| 26 | |
| 27 | Unchanged sources skip the Vite build entirely on subsequent deploys — |
| 28 | the input files are content-hashed (scoped by `memo.include`). |
| 29 | |
| 30 | ## Local development |
| 31 | |
| 32 | ```sh |
| 33 | bun run dev |
| 34 | ``` |
| 35 | |
| 36 | `alchemy dev` runs Vite's own dev server (HMR included) — no cloud |
| 37 | resources are created. |
| 38 | |
| 39 | ## Destroy |
| 40 | |
| 41 | ```sh |
| 42 | bun run destroy |
| 43 | ``` |