Vite HMR API 暴露

Vite 通过特殊的 import.meta.hot 对象暴露手动 HMR API。

interface ImportMeta {
  readonly hot?: {
    readonly data: any

    accept(): void
    accept(cb: (mod: any) => void): void
    accept(dep: string, cb: (mod: any) => void): void
    accept(deps: string[], cb: (mods: any[]) => void): void

    prune(cb: () => void): void
    dispose(cb: (data: any) => void): void
    decline(): void
    invalidate(): void

    on(event: string, cb: (...args: any[]) => void): void
  }
}

作者:terry,如若转载,请注明出处:https://www.web176.com/vite/23797.html

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2023年6月7日
下一篇 2023年6月7日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注