aero() Vite plugin. For larger projects, you can move Aero options into a dedicated aero.config.ts.
The Vite plugin
Addaero() to vite.config.ts:
vite.config.ts
Plugin options
| Option | Type | Description |
|---|---|---|
content | boolean | object | Enable content collections. Default false. |
server | boolean | Enable Nitro for API routes. Default false. |
site | string | object | Canonical site URL. Exposed as import.meta.env.SITE and Aero.site. |
redirects | Array<{ from, to, status? }> | Path redirects for dev and production. |
middleware | Array | Dev-only request handlers. |
dirs | object | Override client, server, and dist directory names. |
apiPrefix | string | URL prefix for API routes. Default '/api'. |
vite.config.ts
Dedicated aero.config.ts
For projects with more complex configuration, use@aero-js/config to keep Aero options separate from Vite:
aero.config.ts
vite.config.ts
createViteConfig() with no arguments auto-loads aero.config.ts from the project root.
Env-aware config
Pass a function todefineConfig() to vary options by mode:
aero.config.ts
Path aliases
Aero injects default path aliases so imports work withouttsconfig.json configuration:
| Alias | Resolves to |
|---|---|
@components/* | client/components/* |
@layouts/* | client/layouts/* |
@pages/* | client/pages/* |
@content/* | content/* |
@styles/* | client/assets/styles/* |
@scripts/* | client/assets/scripts/* |
@images/* | client/assets/images/* |
tsconfig.json under compilerOptions.paths. They merge with the defaults.
Environment variables
Aero uses Vite’s environment variable system. Variables in.env files are available in build scripts by default. Prefix with VITE_ to expose them to client scripts:
| Prefix | Available in |
|---|---|
| (none) | Build scripts and server only |
VITE_ | Build scripts and client scripts |
.env
.env, .env.local, .env.[mode], and .env.[mode].local in order. Shell variables override file values.