sindresorhus / globby

User-friendly glob matching
MIT License
2.53k stars 130 forks source link

Maximum call stack size exceeded when used on large folders #141

Closed chrisdavies closed 4 years ago

chrisdavies commented 4 years ago

I'm seeing the error: FATAL RangeError: Maximum call stack size exceeded while attempting to run this on a very large directory.

The reason is that each file path (84K of them in my case) is spread in arrayUnion, meaning it's placed on the stack.

This can be fixed by changing return arrayUnion(...tasks); to instead be something like return arrayUnion(tasks); and changing arrayUnion to take a single array of arrays, instead of spread.

I can open a PR sometime, but it might be a while, as it depends on my (rare) spare time!

chrisdavies commented 4 years ago

I tried reproducing this in the tests folder of this project, and was unable, so I'm closing for now. I imagine the issue I was seeing in my own project was a combination of things, and may have been due to the fact that we're on an older version of globby / del.