Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Allow a Regex in createFilter #5

Closed
dtothefp opened this issue Feb 3, 2016 · 5 comments
Closed

Allow a Regex in createFilter #5

dtothefp opened this issue Feb 3, 2016 · 5 comments

Comments

@dtothefp
Copy link

dtothefp commented Feb 3, 2016

It seems annoying to have to learn the intricacies of the mini-match API in order to include and exclude especially for people who are transitioning from a tool like Webpack, where Regex is used a lot.

This is especially useful for I would think a not uncommon use case of an internal NPM registry containing un-compiled es6 modules. In Webpack for the babel-loader I'm able to use the regex below in the exclude field:

/^.+\/node_modules\/(?!@hfa\/).+\.jsx?$/

To only compile internal es6 modules in the @hfa namespace. Maybe this is possible with a combination of include and exclude using minimatch but doesn't seem user friendly to not be able to re-use regex that I'm using with another tool. In the above example I feel minimatch would be overcomplicated because you need to account for modules inside @hfa that may have their own internal dependency on an @hfa module and so on, being sure to only compile the source of each module and not an commonjs module dependency inside of the @hfa or nested @hfa node_modules directory. Would you be open to allowing regex and/or minimatch string as input to createFilter? If so, I'd be happy to put a PR together.

screen shot 2016-02-03 at 12 06 24 am

@dtothefp
Copy link
Author

dtothefp commented Mar 8, 2016

@Rich-Harris any suggestions on this?

@Rich-Harris
Copy link
Contributor

@dtothefp sorry, just saw this. Would gladly accept that PR! 😀

@jetiny
Copy link
Contributor

jetiny commented Nov 12, 2016

@Rich-Harris is this ok ?

@Rich-Harris
Copy link
Contributor

This can finally be closed – v2.0.0 (major version change, so plugins will need to upgrade) supports regexes. Thanks

@dtothefp
Copy link
Author

dtothefp commented Jan 3, 2017

Cool, thanks!! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants