Skip to content

Commit

Permalink
perf: use workspace root for fs cache (#15712)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev authored Jan 25, 2024
1 parent f9c33ad commit 8815763
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite/src/node/fsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
safeRealpathSync,
tryStatSync,
} from './utils'
import { searchForWorkspaceRoot } from './server/searchRoot'

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

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

Expand Down

0 comments on commit 8815763

Please sign in to comment.