From 59fe913f122696ed94ac3f78655576fe7eef98d6 Mon Sep 17 00:00:00 2001 From: CHOYSEN Date: Sun, 31 Jan 2021 02:52:02 +0800 Subject: [PATCH] fix(hmr): do not update on file unlink when there are no affected modules (#1818) --- packages/vite/src/node/server/hmr.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/vite/src/node/server/hmr.ts b/packages/vite/src/node/server/hmr.ts index 1c833d94034f2e..f5ffa9a9fdc82e 100644 --- a/packages/vite/src/node/server/hmr.ts +++ b/packages/vite/src/node/server/hmr.ts @@ -174,12 +174,14 @@ export async function handleFileAddUnlink( modules.push(module) } } - updateModules( - getShortName(file, server.config.root), - modules, - Date.now(), - server - ) + if (modules.length > 0) { + updateModules( + getShortName(file, server.config.root), + modules, + Date.now(), + server + ) + } } }