From 110e2e1651cf09b45e4c5e8700c3710b7908e6a5 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Fri, 19 Jan 2024 15:12:04 +0100 Subject: [PATCH] refactor(hmr): provide a separate logger interface (#15631) --- packages/vite/src/shared/hmr.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/shared/hmr.ts b/packages/vite/src/shared/hmr.ts index 9617ddb3a..f313a51a6 100644 --- a/packages/vite/src/shared/hmr.ts +++ b/packages/vite/src/shared/hmr.ts @@ -15,6 +15,11 @@ interface HotCallback { fn: (modules: Array) => 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,