Tooling concepts

Build-time configuration and public environment variables

Try the free JavaScript compiler

Browser build-time configuration becomes part of the delivered application. In Vite, import.meta.env exposes built-in values and, by default, user variables prefixed VITE_. Never put API private keys in VITE_ variables. A hidden UI does not hide the downloaded JavaScript. Example type: javascript. Context: vite-lab. Expected observation: With VITE_APP_LABEL=Notebook, logs Notebook.. Manual integration; not executed here.

Formal Syntax & Structure

javascript syntaxjavascript
// vite-lab/src/main.js; requires Vite, not plain Node.console.log(import.meta.env.VITE_APP_LABEL);

Working Example

Example Snippetjavascript
// vite-lab/src/main.js; requires Vite, not plain Node.console.log(import.meta.env.VITE_APP_LABEL);
JavaScript Reference