Skip to content
Open
Changes from all commits
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
2 changes: 2 additions & 0 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export default defineConfig(async ({ command, mode }) => {
})
```

When using TypeScript with callback-based config (`defineConfig(() => ...)` or `defineConfig(async () => ...)`), some nested string literals may be widened to `string` by TypeScript. If you see an overload error for a literal option (for example `build.minify`), add `as const` to that value or annotate the callback return type.

## Using Environment Variables in Config

Environment variables available while the config itself is being evaluated are only those that already exist in the current process environment (`process.env`). Vite deliberately defers loading any `.env*` files until _after_ the user config has been resolved because the set of files to load depends on config options like [`root`](/guide/#index-html-and-project-root) and [`envDir`](/config/shared-options.md#envdir), and also on the final `mode`.
Expand Down
Loading