From 23fdef1dec68ff5552f140659e83a18dc8b0b060 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 12 Apr 2022 23:23:44 +0800 Subject: [PATCH] chore: type unknown env as any (#7702) --- docs/guide/env-and-mode.md | 2 +- packages/vite/types/importMeta.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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