diff --git a/docs/guide/env-and-mode.md b/docs/guide/env-and-mode.md index 1649feda8c7501..b2b1264e85a8e4 100644 --- a/docs/guide/env-and-mode.md +++ b/docs/guide/env-and-mode.md @@ -42,7 +42,7 @@ In addition, environment variables that already exist when Vite is executed have `.env` files are loaded at the start of Vite. Restart the server after making changes. ::: -Loaded env variables are also exposed to your client source code via `import.meta.env`. +Loaded env variables are also exposed to your client source code via `import.meta.env` as strings. To prevent accidentally leaking env variables to the client, only variables prefixed with `VITE_` are exposed to your Vite-processed code. e.g. the following file: diff --git a/packages/vite/types/importMeta.d.ts b/packages/vite/types/importMeta.d.ts index 9b57fd120a7ba9..900b975d37d6ad 100644 --- a/packages/vite/types/importMeta.d.ts +++ b/packages/vite/types/importMeta.d.ts @@ -36,7 +36,7 @@ interface ImportMeta { } interface ImportMetaEnv { - [key: string]: string | boolean | undefined + [key: string]: any BASE_URL: string MODE: string DEV: boolean