| 1 | // @ts-check |
| 2 | // Real user config file. The toolchain must load this NATIVELY (astro's own |
| 3 | // config discovery) and merge its inline overlay OVER it — nothing here works |
| 4 | // unless the file is honored: |
| 5 | // |
| 6 | // - `integrations`: a user integration injecting the on-demand |
| 7 | // `/user-integration` route (the "does react/mdx/tailwind work?" proof). |
| 8 | // - `vite.define`: a user Vite setting observable in the rendered HTML. |
| 9 | // |
| 10 | // No `adapter` — the deploy target provides it (declaring one here fails the |
| 11 | // build with an actionable error). |
| 12 | import { defineConfig } from "astro/config"; |
| 13 | |
| 14 | /** @returns {import("astro").AstroIntegration} */ |
| 15 | const userIntegration = () => ({ |
| 16 | name: "fixture-user-integration", |
| 17 | hooks: { |
| 18 | "astro:config:setup": ({ injectRoute }) => { |
| 19 | injectRoute({ |
| 20 | pattern: "/user-integration", |
| 21 | entrypoint: new URL("./src/user-integration.astro", import.meta.url), |
| 22 | }); |
| 23 | }, |
| 24 | }, |
| 25 | }); |
| 26 | |
| 27 | export default defineConfig({ |
| 28 | // On-demand rendering with per-page `export const prerender = true` |
| 29 | // opt-ins. The toolchain no longer defaults `output` (astro's own default |
| 30 | // is `"static"`), so the SSR-first intent is declared here — and honoring |
| 31 | // it is itself part of the user-config proof. |
| 32 | output: "server", |
| 33 | integrations: [userIntegration()], |
| 34 | vite: { |
| 35 | define: { |
| 36 | __USER_VITE_DEFINE__: JSON.stringify("hello-from-user-vite-define"), |
| 37 | }, |
| 38 | }, |
| 39 | }); |