Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/content/docs/en/reference/integrations-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,18 @@ declare global {

Astro reserves the `astro:` prefix for future built-in hooks. Please choose a different prefix when naming your custom hook.

## Astro vite environments

Since v6, Astro is based on `vite` v7 and it heavily uses its [environment APIs](https://vite.dev/guide/api-environment).

Astro build environments:
- `ssr`: the classic and default `ssr` environment of `vite`. Astro uses this environment to build dynamic routes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also used for non-dynamic routes in dev.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worth having a small paragraph for dev? At line 1197 I mention build

Copy link
Contributor

@matthewp matthewp Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the goal is to explain that Astro uses environments now I would probably explain it all together. If the goal is to explain how there's prerender as a special environment in the build, I would explain the reasoning for this documentation more. Like for example something like:

Astro inherits the environments Vite provides by default, `ssr` and `client`. Additionally there is the the `prerender` environment provided by Astro. Here's what each of these environments are used for:

- `client`: the classic and default `client` environment of `vite`. Astro uses this environment to generate client assets, such as scripts, styles, etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Calling this and ssr "classic" is a little confusing to me. I think maybe instead you are wanting to say that they are vite-defined or built-in or something to that effect.

- `prerender`: an environment that is created to build static pages.


If your integrations rely on `vite` environments and the Astro build, you might want to optimise based on these environments provided.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would link to Vite's docs on environment (which imo aren't great but its what we have).

I might also mention that the primary thing you do with environment is apply config.


## Integration types reference

### `AstroIntegrationLogger`
Expand Down
Loading