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.
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
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/main-vite-using-environment-instances-branch-workflow-guide.md | A 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-.text | A 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-.text | A 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.text | A 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.text | The 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.text | A 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.text | A 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.text | A 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.text | A 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.text | The 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
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - 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