refactor(hmr): provide a separate logger interface (#15631)

This commit is contained in:
Vladimir 2024-01-19 15:12:04 +01:00 committed by GitHub
parent 5b4be42ad8
commit 110e2e1651
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,11 @@ interface HotCallback {
fn: (modules: Array<ModuleNamespace | undefined>) => void
}
export interface HMRLogger {
error(msg: string | Error): void
debug(...msg: unknown[]): void
}
export interface HMRConnection {
/**
* Checked before sending messages to the client.
@ -196,7 +201,7 @@ export class HMRClient {
public messenger: HMRMessenger
constructor(
public logger: Console,
public logger: HMRLogger,
connection: HMRConnection,
// This allows implementing reloading via different methods depending on the environment
private importUpdatedModule: (update: Update) => Promise<ModuleNamespace>,