# vite-hot-client

> Get Vite's import.meta.hot at runtime.

Latest version **2.2.0** (published 2026-05-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install vite-hot-client
pnpm add vite-hot-client
yarn add vite-hot-client
bun add vite-hot-client
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2026-05-01 |
| First published | 2022-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 43 |
| Author | Anthony Fu |
| Maintainers | antfu |

## Links

- npm: https://www.npmjs.com/package/vite-hot-client
- Repository: https://github.com/antfu/vite-hot-client
- Homepage: https://github.com/antfu/vite-hot-client#readme
- Issues: https://github.com/antfu/vite-hot-client/issues
- Funding: https://github.com/sponsors/antfu
- npm.io page: https://npm.io/package/vite-hot-client

## Recent versions

- 2.2.0 (latest) — 2026-05-01
- 2.1.0 — 2025-06-29
- 2.0.4 — 2025-01-09
- 0.2.4 — 2024-11-27
- 0.2.3 — 2023-11-16
- 0.2.2 — 2023-08-28
- 0.2.1 — 2023-04-06
- 0.2.0 — 2023-02-27
- 0.1.1 — 2022-11-21
- 0.1.0 — 2022-06-30
- 0.0.1 — 2022-03-26
- 0.0.0 — 2022-03-26

## README

# vite-hot-client

[![NPM version](https://img.shields.io/npm/v/vite-hot-client?color=a1b858&label=)](https://www.npmjs.com/package/vite-hot-client)

Get Vite's `import.meta.hot` at runtime.

**You don't normally need this library directly**. It's designed for embedded UI on top of Vite for client-server communication. For example:

- [`vite-plugin-inspect`](https://github.com/antfu/vite-plugin-inspect)
- [`@unocss/inspector`](https://github.com/unocss/unocss/tree/main/packages/inspector)
- [`@vitest/ui`](https://github.com/vitest-dev/vitest/tree/main/packages/ui)

## Install

```bash
npm i vite-hot-client
```

## Usage

```js
import { hot } from 'vite-hot-client'

// import.meta.hot
if (hot) {
  hot.on('update', () => {
    // ...
  })
}
```

```js
import { createHotContext } from 'vite-hot-client'

const hot = createHotContext('/path/to/module')

if (hot) {
  // ...
}
```

## Sponsors

<p align="center">
  <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
    <img src="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg" alt="Sponsors"/>
  </a>
</p>

## License

[MIT](./LICENSE) License © 2022 [Anthony Fu](https://github.com/antfu)

---
_Source: https://npm.io/package/vite-hot-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
