Skip to content

Commit

Permalink
chore: remove confusing comment
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Nov 8, 2022
1 parent c1380cd commit 343e206
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions packages/vite/src/node/plugins/resolve.ts
Expand Up @@ -531,9 +531,6 @@ function tryResolveFile(
tryPrefix?: string,
skipPackageJson?: boolean
): string | undefined {
// #2051 if we don't have read permission on a directory, existsSync() still
// works and will result in massively slow subsequent checks (which are
// unnecessary in the first place)
if (isFileReadable(file)) {
if (!fs.statSync(file).isDirectory()) {
return getRealPath(file, options.preserveSymlinks) + postfix
Expand Down
6 changes: 0 additions & 6 deletions packages/vite/src/node/utils.ts
Expand Up @@ -535,12 +535,6 @@ export function writeFile(
fs.writeFileSync(filename, content)
}

/**
* Use fs.statSync(filename) instead of fs.existsSync(filename)
* #2051 if we don't have read permission on a directory, existsSync() still
* works and will result in massively slow subsequent checks (which are
* unnecessary in the first place)
*/
export function isFileReadable(filename: string): boolean {
try {
const stat = fs.statSync(filename, { throwIfNoEntry: false })
Expand Down

0 comments on commit 343e206

Please sign in to comment.