Prompt Buddy logoPrompt Buddy

vite · Vite Docs

Vite Vite Env Variables and Modes

Explains how to use environment variables via import.meta.env and how to manage different build modes in Vite.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Vite Vite Env Variables and Modes

Explains how to use environment variables via import.meta.env and how to manage different build modes in Vite.

When To Use

Use when you need to access environment variables in client-side code or configure different application behaviors based on development, production, or custom modes.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/vite-env-variables-and-modes-workflow-guide.mdA guide explaining Vite's built-in constants, environment variables, .env file usage, and TypeScript IntelliSense configuration.Questions about a guide explaining Vite's built-in constants, environment variables, .env file usage, and TypeScript IntelliSense con...
examples/vite-env-variables-and-modes-usage.textA text example demonstrating how to access Vite environment variables and mode flags using import.meta.env.Exact payloads, commands, or snippets shown in A text example demonstrating how to access Vite environment variables and mode flags using import.meta.env.
examples/vite-env-variables-and-modes.textAn example of environment variable declarations using the VITE_ prefix for use within a Vite project.Exact payloads, commands, or snippets shown in An example of environment variable declarations using the VITE prefix for use within a Vite project.
examples/vite-env-variables-and-modes-access.textA text example demonstrating how to access environment variables using import.meta.env in a Vite project.Exact payloads, commands, or snippets shown in A text example demonstrating how to access environment variables using import.meta.env in a Vite project.
examples/vite-env-variables-and-modes-vite-env-variable-loading-priority-modes.textA text file demonstrating the hierarchy and loading rules for .env files across different modes and local overrides.Exact payloads, commands, or snippets shown in A text file demonstrating the hierarchy and loading rules for .env files across different modes and local overrides.
examples/vite-env-variables-and-modes-dotenv-syntax-examples.textA text file demonstrating how to use special characters and variable expansion within Vite environment variable definitions.Exact payloads, commands, or snippets shown in A text file demonstrating how to use special characters and variable expansion within Vite environment variable defin...
examples/vite-env-variables-and-modes-2.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/vite-env-variables-and-modes-typescript-interface-definition.textA TypeScript interface definition for strict typing of ImportMetaEnv and ImportMeta in a Vite project.Exact payloads, commands, or snippets shown in A TypeScript interface definition for strict typing of ImportMetaEnv and ImportMeta in a Vite project.
examples/vite-env-variables-and-modes-configuration.textA text configuration demonstrating how Vite handles environment variables and mode-specific settings.Exact payloads, commands, or snippets shown in A text configuration demonstrating how Vite handles environment variables and mode-specific settings.
examples/vite-env-variables-and-modes-3.textA text example demonstrating the use of Vite environment variables and mode interpolation within a template string.Exact payloads, commands, or snippets shown in A text example demonstrating the use of Vite environment variables and mode interpolation within a template string.
examples/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/vite-env-variables-and-modes-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/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/vite-env-variables-and-modes-node-env-development.textAn example demonstrating the use of the NODE_ENV=development environment variable within a Vite project.Exact payloads, commands, or snippets shown in An example demonstrating the use 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://vite.dev/guide/env-and-mode