Skip to content

Slow performance when globbing shallow files #73

@bluwy

Description

@bluwy

When globbing like */package.json or */*/package.json, it runs very slowly as presumably it's crawling more files recursively like node_modules.

import { globSync } from 'tinyglobby'
console.log(globSync('*/package.json', { expandDirectories: false }))

When I try with fast-glob, it worked fast ootb:

import fg from 'fast-glob'
console.log(fg.globSync('*/package.json'))

I'm able to workaround this by adding ignore: ['**/node_modules/**'] but I shouldn't need to in the first place I believe. And IIUC the paths are still crawled recursively pass the first directory depth unnecessarily as I only specified one-level deep with */package.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions