Skip to content

antfu/vite-hot-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

40c60b9 · Jan 9, 2025

History

34 Commits
Nov 27, 2024
Nov 16, 2023
Aug 28, 2023
Nov 27, 2024
Mar 26, 2022
Mar 26, 2022
Mar 26, 2022
Mar 26, 2022
Mar 26, 2022
Nov 16, 2023
Jan 9, 2025
Jan 9, 2025
Mar 26, 2022
Nov 16, 2023

Repository files navigation

vite-hot-client

NPM version

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:

Install

npm i vite-hot-client

Usage

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

// import.meta.hot
if (hot) {
  hot.on('update', () => {
    // ...
  })
}
import { createHotContext } from 'vite-hot-client'

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

if (hot) {
  // ...
}

Sponsors

License

MIT License © 2022 Anthony Fu