Skip to content

Commit

Permalink
fix(config): watch envDir even outside of root (#12349)
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework authored Mar 10, 2023
1 parent f89f12a commit 131f3ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ export type ResolvedConfig = Readonly<
/** @internal */
mainConfig: ResolvedConfig | null
isProduction: boolean
envDir: string
env: Record<string, any>
resolve: Required<ResolveOptions> & {
alias: Alias[]
Expand Down Expand Up @@ -659,6 +660,7 @@ export async function resolveConfig(
server,
build: resolvedBuildOptions,
preview: resolvePreviewOptions(config.preview, server),
envDir,
env: {
...userEnv,
BASE_URL,
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/node/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ export async function createServer(
}

const watcher = chokidar.watch(
// config file dependencies might be outside of root
[path.resolve(root), ...config.configFileDependencies],
// config file dependencies and env file might be outside of root
[root, ...config.configFileDependencies, config.envDir],
resolvedWatchOptions,
) as FSWatcher

Expand Down

0 comments on commit 131f3ee

Please sign in to comment.