diff --git a/packages/vite/src/node/plugins/esbuild.ts b/packages/vite/src/node/plugins/esbuild.ts index 1e6e4927e87718..bd1f7dfae90ba9 100644 --- a/packages/vite/src/node/plugins/esbuild.ts +++ b/packages/vite/src/node/plugins/esbuild.ts @@ -485,6 +485,8 @@ async function loadTsconfigJsonForFile( } function reloadOnTsconfigChange(changedFile: string) { + // server could be closed externally after a file change is detected + if (!server) return // any tsconfig.json that's added in the workspace could be closer to a code file than a previously cached one // any json file in the tsconfig cache could have been used to compile ts if (