property
ImportMeta.hot
hot: { data: any; accept(): void; dispose(cb: (data: any) => void | Promise<void>): void; off(event: HMREvent, callback: () => void): void; on(event: HMREvent, callback: () => void): void }
Hot module replacement (HMR) APIs. In production this value is undefined, so you can guard HMR code with an if statement:
if (import.meta.hot) {
// HMR APIs are available
}The check is usually unnecessary: Bun dead-code-eliminates calls to the HMR APIs in production builds.
https://bun.com/docs/bundler/hmr