Skip to content

Commit

Permalink
close build watcher when the server closes
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Oct 13, 2023
1 parent 3dca3b0 commit 39eb80d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,10 @@ if (MODE === 'development') {
const dirname = path.dirname(fileURLToPath(import.meta.url))
const watchPath = path.join(dirname, WATCH_PATH).replace(/\\/g, '/')

chokidar
const buildWatcher = chokidar
.watch(watchPath, { ignoreInitial: true })
.on('add', reloadBuild)
.on('change', reloadBuild)

closeWithGrace(() => buildWatcher.close())
}

0 comments on commit 39eb80d

Please sign in to comment.