Prompt Buddy logoPrompt Buddy

vite · Vite Docs

Vite Vite Environment API for Plugins

Explains how to use the Vite Environment API to create plugins that interact with different environments and manage module loading across them.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Vite Vite Environment API for Plugins

Explains how to use the Vite Environment API to create plugins that interact with different environments and manage module loading across them.

When To Use

Use when developing Vite plugins that need to handle environment-specific logic or manage module execution across multiple environments.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/vite-environment-api-for-plugins-workflow-guide.mdDocumentation detailing how to access, register, and configure environments using the Vite Environment API within plugin hooks.Questions about documentation detailing how to access, register, and configure environments using the Vite Environment API within plu...
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-transform.textA code example demonstrating how to access the environment configuration within a Vite plugin's transform hook.Exact payloads, commands, or snippets shown in A code example demonstrating how to access the environment configuration within a Vite plugin's transform hook.
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-config.textA code example demonstrating how to use the Vite Environment API to define custom environments and resolve conditions within a plugin configuration.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the Vite Environment API to define custom environments and resolve conditions...
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-config-envi.textA code example demonstrating how to use the configEnvironment function within a Vite plugin to configure environment-specific resolution conditions.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the configEnvironment function within a Vite plugin to configure environment-...
examples/vite-environment-api-for-plugins-vite-environment-api-hot-update-options.textThe HotUpdateOptions interface definition used within the Vite Environment API for plugins.Exact payloads, commands, or snippets shown in The HotUpdateOptions interface definition used within the Vite Environment API for plugins.
examples/vite-environment-api-for-plugins-vite-environment-api-hot-update-plugin.textA plugin implementation demonstrating the use of the Vite Environment API to handle hot module replacement updates.Exact payloads, commands, or snippets shown in A plugin implementation demonstrating the use of the Vite Environment API to handle hot module replacement updates.
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-hot-update.textA code example demonstrating how to use the hotUpdate method within the Vite Environment API to send custom events to specific environments.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the hotUpdate method within the Vite Environment API to send custom events to...
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-hot-update-2.textA code example demonstrating how to use the Vite Environment API to handle custom hot updates within a plugin.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the Vite Environment API to handle custom hot updates within a plugin.
examples/vite-environment-api-for-plugins-vite-environment-api-per-environment-co.textA JavaScript plugin implementation that tracks and logs the number of transformed modules for each specific Vite environment.Exact payloads, commands, or snippets shown in A JavaScript plugin implementation that tracks and logs the number of transformed modules for each specific Vite envi...
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-implementat.textA JavaScript code example demonstrating how to use the Vite Environment API within a plugin to manage per-environment state and hooks.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the Vite Environment API within a plugin to manage per-environment...
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-applytoenvi.textA code example demonstrating how to use the applyToEnvironment hook within a Vite plugin to return environment-specific plugins.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the applyToEnvironment hook within a Vite plugin to return environment-specif...
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-per-environ.textA code example demonstrating how to use the Vite Environment API to create a plugin that provides non-shareable resources for specific environments.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the Vite Environment API to create a plugin that provides non-shareable resou...
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-configure-s.textA JavaScript code example demonstrating how to use the configureServer hook to listen for and send custom hot events within a Vite environment.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the configureServer hook to listen for and send custom hot events...
examples/vite-environment-api-for-plugins-vite-environment-api-plugin-shared-stat.textA JavaScript code example demonstrating how to use the sharedDuringBuild property in a Vite plugin to share state across environments.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the sharedDuringBuild property in a Vite plugin to share state acr...

What This Skill Covers

  • Are you an LLM? You can read better optimized documentation at /guide/api-environment-plugins.md for this page in Markdown format
  • Main sections: Accessing the Current Environment in Hooks ​, Registering New Environments Using Hooks ​, Configuring Environment Using Hooks ​, The hotUpdate Hook ​, Per-environment State in Plugins ​.

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