Prompt Buddy logoPrompt Buddy

vite · Vite Docs

Env Variables and Modes | Vite (main branch)

Explains how to use environment variables with the VITE_ prefix and how to manage different application modes like development and production.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Env Variables and Modes | Vite (main branch)

Explains how to use environment variables with the VITE_ prefix and how to manage different application modes like development and production.

When To Use

Use when you need to expose environment variables to your client-side code or configure application behavior based on the current build mode.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/main-vite-env-variables-and-modes-branch-workflow-guide.mdA guide explaining Vite's built-in constants, environment variable handling via .env files, and TypeScript IntelliSense support.Questions about a guide explaining Vite's built-in constants, environment variable handling via .env files, and TypeScript IntelliSen...
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-us.textA text example demonstrating how to access environment variables and mode flags using import.meta.env in a Vite project.Exact payloads, commands, or snippets shown in A text example demonstrating how to access environment variables and mode flags using import.meta.env in a Vite project.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes.textAn example demonstrating the syntax for defining environment variables using the VITE_ prefix.Exact payloads, commands, or snippets shown in An example demonstrating the syntax for defining environment variables using the VITE prefix.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-us-2.textA demonstration of accessing environment variables via import.meta.env and the behavior of prefixed versus non-prefixed variables in Vite.Exact payloads, commands, or snippets shown in A demonstration of accessing environment variables via import.meta.env and the behavior of prefixed versus non-prefix...
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-co.textA text file demonstrating the hierarchy and loading rules for different .env file variations in Vite.Exact payloads, commands, or snippets shown in A text file demonstrating the hierarchy and loading rules for different .env file variations in Vite.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-2.textA text file demonstrating how to define environment variables with special characters and comments for Vite.Exact payloads, commands, or snippets shown in A text file demonstrating how to define environment variables with special characters and comments for Vite.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-3.textAn example demonstrating the syntax for defining and interpolating environment variables in a Vite configuration.Exact payloads, commands, or snippets shown in An example demonstrating the syntax for defining and interpolating environment variables in a Vite configuration.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-im.textA TypeScript interface definition for strict typing of ImportMetaEnv to allow custom environment variable keys in Vite.Exact payloads, commands, or snippets shown in A TypeScript interface definition for strict typing of ImportMetaEnv to allow custom environment variable keys in Vite.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-co-2.textA configuration example demonstrating how to define and use environment variables and modes within a Vite project.Exact payloads, commands, or snippets shown in A configuration example demonstrating how to define and use environment variables and modes within a Vite project.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-us-3.textA text example demonstrating how to use environment variables and mode placeholders within a Vite application template.Exact payloads, commands, or snippets shown in A text example demonstrating how to use environment variables and mode placeholders within a Vite application template.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-4.textAn example demonstrating the syntax for defining environment variables using the VITE_ prefix.Exact payloads, commands, or snippets shown in An example demonstrating the syntax for defining environment variables using the VITE prefix.
examples/main-vite-env-variables-and-modes-branch-vite-build-mode-staging-command.textA command line instruction demonstrating how to use the vite build command with the staging mode flag.Exact payloads, commands, or snippets shown in A command line instruction demonstrating how to use the vite build command with the staging mode flag.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-5.textAn example demonstrating the syntax for defining environment variables using the VITE_ prefix for different modes.Exact payloads, commands, or snippets shown in An example demonstrating the syntax for defining environment variables using the VITE prefix for different modes.
examples/main-vite-env-variables-and-modes-branch-vite-env-variables-and-modes-no.textA text example demonstrating the usage of the NODE_ENV=development environment variable within a Vite project.Exact payloads, commands, or snippets shown in A text example demonstrating the usage of the NODEENV=development environment variable within a Vite project.

What This Skill Covers

  • Are you an LLM? You can read better optimized documentation at /guide/env-and-mode.md for this page in Markdown format
  • Main sections: Built-in Constants ​, Env Variables ​, .env Files ​, IntelliSense for TypeScript ​, HTML Constant Replacement ​.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://main.vite.dev/guide/env-and-mode