Skip to content

Commit

Permalink
fix: windows add/delete file
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Jan 25, 2024
1 parent 98bc3dc commit 3a7b650
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/vite/src/node/fsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,24 +219,28 @@ export function createCachedFsUtils(config: ResolvedConfig): FsUtils {
file: string,
type: 'directory_maybe_symlink' | 'file_maybe_symlink',
) {
const direntCache = getDirentCacheFromPath(path.dirname(file))
const direntCache = getDirentCacheFromPath(
normalizePath(path.dirname(file)),
)
if (
direntCache &&
direntCache.type === 'directory' &&
direntCache.dirents
) {
direntCache.dirents.set(path.basename(file), { type })
direntCache.dirents.set(normalizePath(path.basename(file)), { type })
}
}

function onPathUnlink(file: string) {
const direntCache = getDirentCacheFromPath(path.dirname(file))
const direntCache = getDirentCacheFromPath(
normalizePath(path.dirname(file)),
)
if (
direntCache &&
direntCache.type === 'directory' &&
direntCache.dirents
) {
direntCache.dirents.delete(path.basename(file))
direntCache.dirents.delete(normalizePath(path.basename(file)))
}
}

Expand Down

0 comments on commit 3a7b650

Please sign in to comment.