Skip to content

Commit 4b632ae

Browse files
gTutiniGiancarlo Tutini
and
Giancarlo Tutini
authored
fix: add the delay to the server restart function (#24)
Co-authored-by: Giancarlo Tutini <[email protected]>
1 parent b8da6a6 commit 4b632ae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ function VitePluginRestart(options: VitePluginRestartOptions = {}): Plugin {
8888
function handleFileChange(file: string) {
8989
if (micromatch.isMatch(file, restartGlobs)) {
9090
timerState = 'restart'
91-
server.restart()
91+
schedule(() => {
92+
server.restart()
93+
})
9294
}
9395
else if (micromatch.isMatch(file, reloadGlobs) && timerState !== 'restart') {
9496
timerState = 'reload'

0 commit comments

Comments
 (0)