Skip to content

Commit

Permalink
fixup! perf: use fs.readdirSync with withFileTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Jul 6, 2023
1 parent bc574dd commit 3a7fac4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/next/src/server/lib/recursive-readdir-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export function recursiveReadDirSync(
/** Used to replace the initial path, only the relative path is left, it's faster than path.relative. */
rootDir = dir
): string[] {
const result: fs.Dirent[] = fs.readdirSync(dir, { withFileTypes: true })
const result = fs.readdirSync(dir, { withFileTypes: true })

result.forEach((part) => {
const absolutePath = join(dir, part.path)
const absolutePath = join(dir, part.name)

if (part.isDirectory()) {
recursiveReadDirSync(absolutePath, arr, rootDir)
Expand Down

0 comments on commit 3a7fac4

Please sign in to comment.