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

Allow a Regex in createFilter #5

Description

@dtothefp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions