You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
# vite-hot-client
[](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
```bashnpm i vite-hot-client```
## Usage
```jsimport { hot } from 'vite-hot-client'
// import.meta.hotif (hot) { hot.on('update', () => { // ... })}```
```jsimport { 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'/> </a></p>
## License
[MIT](./LICENSE) License © 2022 [Anthony Fu](https://github.com/antfu)
|