Skip to content

Commit

Permalink
refactor(hmr): provide a separate logger interface (#15631)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Jan 19, 2024
1 parent 5b4be42 commit 110e2e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/vite/src/shared/hmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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>,
Expand Down

0 comments on commit 110e2e1

Please sign in to comment.