Skip to content

Commit d12d469

Browse files
authored
fix: check server after tsconfig reload (#9106)
1 parent b393451 commit d12d469

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/vite/src/node/plugins/esbuild.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,14 @@ function reloadOnTsconfigChange(changedFile: string) {
437437

438438
// reset tsconfck so that recompile works with up2date configs
439439
initTSConfck(server.config).finally(() => {
440-
// force full reload
441-
server.ws.send({
442-
type: 'full-reload',
443-
path: '*'
444-
})
440+
// server may not be available if vite config is updated at the same time
441+
if (server) {
442+
// force full reload
443+
server.ws.send({
444+
type: 'full-reload',
445+
path: '*'
446+
})
447+
}
445448
})
446449
}
447450
}

0 commit comments

Comments
 (0)