Prompt Buddy logoPrompt Buddy

vite · Vite Docs

Using Environment Instances | Vite (main branch)

Explains how to use environment instances to manage different sets of environment variables for different build targets or modes within a Vite configuration.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Using Environment Instances | Vite (main branch)

Explains how to use environment instances to manage different sets of environment variables for different build targets or modes within a Vite configuration.

When To Use

Use when you need to configure Vite to handle multiple distinct sets of environment variables for different deployment targets or build modes within a single configuration file.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/main-vite-using-environment-instances-branch-workflow-guide.mdA guide explaining how to access and use the DevEnvironment class and separate module graphs within the Vite Environment API.Questions about a guide explaining how to access and use the DevEnvironment class and separate module graphs within the Vite Environm...
examples/main-vite-using-environment-instances-branch-vite-environment-instances-.textA JavaScript code example demonstrating how to access and interact with client and SSR environment instances using the Vite server API.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to access and interact with client and SSR environment instances using th...
examples/main-vite-using-environment-instances-branch-vite-dev-environment-class-.textA text representation of the DevEnvironment class structure and its properties including name, hot channel, and module graph.Exact payloads, commands, or snippets shown in A text representation of the DevEnvironment class structure and its properties including name, hot channel, and modul...
examples/main-vite-using-environment-instances-branch-vite-dev-environment-contex.textA TypeScript interface definition for the DevEnvironmentContext object used in Vite environment instances.Exact payloads, commands, or snippets shown in A TypeScript interface definition for the DevEnvironmentContext object used in Vite environment instances.
examples/main-vite-using-environment-instances-branch-vite-environment-instances--2.textThe TransformResult interface definition used within Vite environment instances.Exact payloads, commands, or snippets shown in The TransformResult interface definition used within Vite environment instances.
examples/main-vite-using-environment-instances-branch-vite-environment-module-nod.textA text representation of the EnvironmentModuleNode class structure and its properties within the Vite API.Exact payloads, commands, or snippets shown in A text representation of the EnvironmentModuleNode class structure and its properties within the Vite API.
examples/main-vite-using-environment-instances-branch-vite-environment-module-gra.textA TypeScript implementation of the EnvironmentModuleGraph class used for managing environment-specific module maps in Vite.Exact payloads, commands, or snippets shown in A TypeScript implementation of the EnvironmentModuleGraph class used for managing environment-specific module maps in...
examples/main-vite-using-environment-instances-branch-vite-environment-instances--3.textA TypeScript interface definition for CachedFetchResult used to track module cache status in Vite environment instances.Exact payloads, commands, or snippets shown in A TypeScript interface definition for CachedFetchResult used to track module cache status in Vite environment instances.
examples/main-vite-using-environment-instances-branch-vite-environment-instances--4.textA TypeScript interface definition for ExternalFetchResult used within Vite environment instances.Exact payloads, commands, or snippets shown in A TypeScript interface definition for ExternalFetchResult used within Vite environment instances.
examples/main-vite-using-environment-instances-branch-vite-environment-fetch-resu.textThe TypeScript interface definition for ViteFetchResult which includes code, file path, and module ID properties.Exact payloads, commands, or snippets shown in The TypeScript interface definition for ViteFetchResult which includes code, file path, and module ID properties.

What This Skill Covers

  • Are you an LLM? You can read better optimized documentation at /guide/api-environment-instances.md for this page in Markdown format
  • Main sections: Accessing the Environments ​, DevEnvironment class ​, Separate Module Graphs ​.

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/api-environment-instances