From cd9e3e1d9f220820502a11e17958790f49ac3119 Mon Sep 17 00:00:00 2001 From: patak Date: Tue, 7 Nov 2023 16:57:00 +0100 Subject: [PATCH] docs: add note about complex env based replacement (#14899) Co-authored-by: Bjorn Lu --- docs/guide/env-and-mode.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/guide/env-and-mode.md b/docs/guide/env-and-mode.md index 888b516821b7b4..047a1d46c8efdc 100644 --- a/docs/guide/env-and-mode.md +++ b/docs/guide/env-and-mode.md @@ -108,6 +108,8 @@ Vite also supports replacing env variables in HTML files. Any properties in `imp If the env doesn't exist in `import.meta.env`, e.g. `%NON_EXISTENT%`, it will be ignored and not replaced, unlike `import.meta.env.NON_EXISTENT` in JS where it's replaced as `undefined`. +Given that Vite is used by many frameworks, it is intentionally unopinionated about complex replacements like conditionals. Vite can be extended using [an existing userland plugin](https://github.com/vitejs/awesome-vite#transformers) or a custom plugin that implements the [`transformIndexHtml` hook](./api-plugin#transformindexhtml). + ## Modes By default, the dev server (`dev` command) runs in `development` mode and the `build` command runs in `production` mode.