Get Vite's import.meta.hot at runtime.
npm install 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
- @unocss/inspector
- @vitest/ui
``bash`
npm i vite-hot-client
`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) {
// ...
}
``
MIT License © 2022 Anthony Fu