Skip to content

Commit 435a215

Browse files
docs(ui): drop the build-time env-var section from the extension guide
`VITE_API_MODE` is not an extension concern and was only there to sit beside the example switch; it is covered by `playwright/README.md` and `api/config.ts`. A section explaining build-time variables does not belong in a guide about writing an extension. What an extension author actually needed from it — do not put a `VITE_` prefix on your setting, and why that would silently break it — is now one paragraph where settings are already being explained. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Nicholas Bucher <behappy54321@gmail.com>
1 parent e70ff22 commit 435a215

1 file changed

Lines changed: 5 additions & 23 deletions

File tree

ui/docs/app-extensions.md

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -522,29 +522,11 @@ two consequences of it are worth knowing:
522522
the script tag carrying it is synchronous and precedes the app. A module-level
523523
constant can read one; anything awaited would be read after the app had started.
524524

525-
### The two build-time exceptions
526-
527-
`VITE_API_MODE` and `VITE_EXAMPLE_EXTENSION` are the only variables in this UI that
528-
carry a `VITE_` prefix, and neither is a deployment setting:
529-
530-
| | `VITE_API_MODE`, `VITE_EXAMPLE_EXTENSION` | `EXTENSION_*` |
531-
|---|---|---|
532-
| Read with | `import.meta.env` | `readEnv` |
533-
| Fixed when | the bundle is built | the container starts |
534-
| Set by | whoever runs the build | the operator, via `ui.env` |
535-
536-
`VITE_` is not a naming convention to follow. It is Vite's `envPrefix` filter,
537-
which decides what `import.meta.env` exposes to bundled code and guards against
538-
inlining a whole machine's environment into a bundle. It has no bearing on anything
539-
read at runtime, so an extension setting never takes it — prefixed, the variable
540-
would no longer match the `EXTENSION_` prefix the init script and the dev server
541-
select on, and `readEnv` would quietly return the fallback.
542-
543-
`VITE_EXAMPLE_EXTENSION=true` is a switch for the bundled example and nothing else.
544-
It cannot name an extension — an extension has to be *imported* to exist in the
545-
bundle at all, which is the same reason installing one is an edit to
546-
`activeExtensions.ts` rather than a setting. There is no environment variable that
547-
lists the installed extensions; the array is that list.
525+
**Do not add a `VITE_` prefix.** That prefix is Vite's `envPrefix` filter, which
526+
decides what `import.meta.env` exposes to bundled code; it applies to build-time
527+
variables and to nothing else. A prefixed name would no longer match the
528+
`EXTENSION_` prefix the init script and the dev server select on, so the value
529+
would never arrive and `readEnv` would quietly return the fallback.
548530

549531
---
550532

0 commit comments

Comments
 (0)