vite · Vite Docs
HMR API | Vite (main branch)
Explains how to implement custom Hot Module Replacement (HMR) logic using the Vite HMR API to update modules without a full page reload.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
HMR API | Vite (main branch)
Explains how to implement custom Hot Module Replacement (HMR) logic using the Vite HMR API to update modules without a full page reload.
When To Use
Use when implementing custom module update logic or preventing full page reloads during development by intercepting HMR events.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/main-vite-hmr-api-branch-workflow-guide.md | A technical guide detailing the client-side Hot Module Replacement API, including usage of hot.accept and conditional guards. | Questions about a technical guide detailing the client-side Hot Module Replacement API, including usage of hot.accept and conditional... |
examples/main-vite-hmr-api-branch-vite-hmr-api-interface-definition.text | A text representation of the ViteHotContext and ImportMeta interfaces used for Hot Module Replacement. | Exact payloads, commands, or snippets shown in A text representation of the ViteHotContext and ImportMeta interfaces used for Hot Module Replacement. |
examples/main-vite-hmr-api-branch-vite-hmr-api-javascript-usage.text | A code example demonstrating the implementation of the Hot Module Replacement API using the import.meta.hot object. | Exact payloads, commands, or snippets shown in A code example demonstrating the implementation of the Hot Module Replacement API using the import.meta.hot object. |
examples/main-vite-hmr-api-branch-vite-hmr-api-tsconfig-client-types.text | A tsconfig configuration snippet including vite/client types for HMR API support. | Exact payloads, commands, or snippets shown in A tsconfig configuration snippet including vite/client types for HMR API support. |
examples/main-vite-hmr-api-branch-vite-hmr-api-javascript-accept-module.text | A JavaScript code example demonstrating how to use the import.meta.hot.accept method to handle module updates during Hot Module Replacement. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the import.meta.hot.accept method to handle module updates during... |
examples/main-vite-hmr-api-branch-vite-hmr-api-import-meta-hot-accept.text | A code example demonstrating the use of the import.meta.hot.accept API to handle module updates in Vite. | Exact payloads, commands, or snippets shown in A code example demonstrating the use of the import.meta.hot.accept API to handle module updates in Vite. |
examples/main-vite-hmr-api-branch-vite-hmr-api-javascript-setup-side-effect.text | A JavaScript code example demonstrating how to use the import.meta.hot.dispose API to clean up side effects during Hot Module Replacement. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the import.meta.hot.dispose API to clean up side effects during Ho... |
examples/main-vite-hmr-api-branch-vite-hmr-api-setup-or-reuse-side-effect.text | A JavaScript code example demonstrating the use of import.meta.hot.prune for managing side effects within the Vite HMR API. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating the use of import.meta.hot.prune for managing side effects within the Vite HM... |
examples/main-vite-hmr-api-branch-vite-hmr-api-import-meta-hot-data-usage.text | A text example demonstrating the correct way to assign values to import.meta.hot.data in the Vite HMR API. | Exact payloads, commands, or snippets shown in A text example demonstrating the correct way to assign values to import.meta.hot.data in the Vite HMR API. |
examples/main-vite-hmr-api-branch-vite-hmr-api-module-accept.text | A code example demonstrating the use of import.meta.hot.accept to handle module updates in Vite's Hot Module Replacement API. | Exact payloads, commands, or snippets shown in A code example demonstrating the use of import.meta.hot.accept to handle module updates in Vite's Hot Module Replacem... |
What This Skill Covers
- Are you an LLM? You can read better optimized documentation at /guide/api-hmr.md for this page in Markdown format
- Main sections:
Required Conditional Guard ,IntelliSense for TypeScript ,hot.accept(cb) ,hot.accept(deps, cb) ,hot.dispose(cb) .
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-hmr