Open jods4 opened 7 years ago
The reason for not using the glob
module is that it does not support passing a custom fs
implementation. Webpack can use custom filesystems (like an in-memory filesystem) and thus abstracts out a custom fs
implementation which is a subset of the native Node fs
.
I'd be happy to merge a PR with the fix for this. Thanks for reviewing.
Note to self: use Minimatch to get a RegExp from the glob.
The globbing implementation in
expandGlobBase
is incorrect. I am not sure why you didn't use theglob
module directly? It would reduce your code, be correct and support the full glob grammar.Anyway, the most important problem in
expandGlobBase
is that it doesn't match/**/
for direct children. This is caused by your successive regexes that will turn pattern/**/
into the regex[\\/]+\.*?[\\/]+
. Notice how this cannot be smaller than//
, which is not what an empty path looks like.