Skip to content

Commit 8815763

Browse files
authored
perf: use workspace root for fs cache (#15712)
1 parent f9c33ad commit 8815763

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/vite/src/node/fsUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
safeRealpathSync,
99
tryStatSync,
1010
} from './utils'
11+
import { searchForWorkspaceRoot } from './server/searchRoot'
1112

1213
export interface FsUtils {
1314
existsSync: (path: string) => boolean
@@ -124,7 +125,7 @@ function pathUntilPart(root: string, parts: string[], i: number): string {
124125
}
125126

126127
export function createCachedFsUtils(config: ResolvedConfig): FsUtils {
127-
const root = config.root // root is resolved and normalized, so it doesn't have a trailing slash
128+
const root = normalizePath(searchForWorkspaceRoot(config.root))
128129
const rootDirPath = `${root}/`
129130
const rootCache: DirentCache = { type: 'directory' } // dirents will be computed lazily
130131

0 commit comments

Comments
 (0)