Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions packages/vite/src/node/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,14 +469,17 @@ export async function _createServer(

const watcher = chokidar.watch(
// config file dependencies and env file might be outside of root
[
root,
...config.configFileDependencies,
...getEnvFilesForMode(config.mode, config.envDir),
// Watch the public directory explicitly because it might be outside
// of the root directory.
...(publicDir && publicFiles ? [publicDir] : []),
],
// eslint-disable-next-line eqeqeq -- null means disabled
serverConfig.watch === null
? []
: [
root,
...config.configFileDependencies,
...getEnvFilesForMode(config.mode, config.envDir),
// Watch the public directory explicitly because it might be outside
// of the root directory.
...(publicDir && publicFiles ? [publicDir] : []),
],
resolvedWatchOptions,
)
// If watch is turned off, patch `.add()` as a noop to prevent programmatically
Expand All @@ -486,6 +489,7 @@ export async function _createServer(
watcher.add = function () {
return this
}
await watcher.close()
}

const environments: Record<string, DevEnvironment> = {}
Expand Down