tinyglobby icon indicating copy to clipboard operation
tinyglobby copied to clipboard

Support `fs` option

Open benmccann opened this issue 11 months ago • 9 comments

It's needed by copy-webpack-plugin

https://github.com/benmccann/copy-webpack-plugin/blob/8fc1997406dc08ca6458fe4d4377d9aeb0d9dfe4/src/index.js#L343

https://www.npmjs.com/package/fast-glob#fs

benmccann avatar Dec 21 '24 00:12 benmccann

does fdir have support for this? if not it should be added there first

SuperchupuDev avatar Dec 21 '24 13:12 SuperchupuDev

No, I don't see an option for it there

benmccann avatar Dec 21 '24 13:12 benmccann

Can you describe why? Our fs has caching so it speed up incremental builds

alexander-akait avatar Dec 25 '24 15:12 alexander-akait

If you're asking why copy-webpack-plugin needs it, perhaps it doesn't. I just assumed it would be desired since fast-glob was using it. But based off your comment on https://github.com/webpack-contrib/copy-webpack-plugin/issues/788, perhaps we can try without it.

benmccann avatar Dec 25 '24 15:12 benmccann

I'm closing this as it doesn't seem necessary

benmccann avatar Feb 18 '25 00:02 benmccann

@SuperchupuDev Note - avoiding fs option can be bottleneck when you have incremental compilation, for example - I have 1000+ files and want to copy them using https://github.com/webpack-contrib/copy-webpack-plugin/. When we have fs option (i.e. allow to provide own file system), on the first cold start we cache them (stats and content), then developer added a file to directory and we trigger compilation again, it runs the copy plugin again and fs make calls again, but because they are cached it is very fast, but without this option we run real fs calls again, and it can be very slow, we recently migrate to tinyglobby (in https://github.com/webpack-contrib/copy-webpack-plugin/), but I am afraid after the official release you can get such feedback, unfortunately we can't solve this on our side, so I will refer to this problem here, I hope you will think more deeply about this problem and provide an opportunity to solve it (i.e. implement fs option). Thank you

alexander-akait avatar Feb 27 '25 16:02 alexander-akait

i am in support of an fs option, however the same option would need to be added to fdir (the crawling library used here) first, since it's what does the heavy fs operations. since there is a need for the feature i'll reopen this

SuperchupuDev avatar Feb 27 '25 17:02 SuperchupuDev

i've opened https://github.com/thecodrr/fdir/issues/134 on fdir - if fdir's author agrees i'll try to implement it there and pr it

SuperchupuDev avatar Feb 27 '25 17:02 SuperchupuDev

Thanks for feedback, yeah, let's wait an answer

alexander-akait avatar Feb 27 '25 19:02 alexander-akait

@SuperchupuDev Looks like https://github.com/thecodrr/fdir/issues/134 was resolved so we just need to allow passing the fs option

alexander-akait avatar Aug 11 '25 20:08 alexander-akait

i wish we could! but we need to wait for the changes in fdir to be released. i hope it happens soon 🙏

SuperchupuDev avatar Aug 11 '25 20:08 SuperchupuDev