| 1 | import * as Alchemy from "alchemy"; |
| 2 | import * as AWS from "alchemy/AWS"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | |
| 5 | export default Alchemy.Stack( |
| 6 | "AwsWebsiteViteExample", |
| 7 | { |
| 8 | providers: AWS.providers(), |
| 9 | state: AWS.state(), |
| 10 | }, |
| 11 | Effect.gen(function* () { |
| 12 | // A plain Vite SPA: static assets in S3 behind CloudFront. `spa` |
| 13 | // defaults on, so unmatched paths answer with the index page (200). |
| 14 | const site = yield* AWS.Website.Vite("Website", { |
| 15 | // Only hash the files that affect the build, so unchanged sources |
| 16 | // skip the Vite build (and the deploy) entirely. |
| 17 | memo: { |
| 18 | include: ["src/**", "index.html", "package.json", "vite.config.ts"], |
| 19 | }, |
| 20 | forceDestroy: true, |
| 21 | }); |
| 22 | |
| 23 | return { |
| 24 | url: site.url, |
| 25 | }; |
| 26 | }), |
| 27 | ); |