-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Plugin filter
RegEx doesn't support case-insensitive flag
#4121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, looking at the source it passes only the { filter: /\.[Cc]([pP][pP])?$/ } |
@hyrious Thanks for the link to the code that verifies what I'm seeing. I was mostly filing the issue to bring light to the lack of support. As you mentioned, this particular case could certainly be recomposed to handle all of the permutations as part of the pattern, though I intentionally picked a relatively simple case as an example. Sadly, expanding out my actual use case is a little bit messier. 😬 |
Thanks for bringing this to my attention. This is just an oversight. It hadn't occurred to me to test this, and it's never come up for me. Of course it's very reasonable that this should work. The way esbuild handles this is by taking the JavaScript regexp source code and passing it to Go's regexp engine. Apparently Go handles flags differently from JavaScript. The JavaScript regular expression |
Thanks, Evan! |
The
filter
argument for theonResolve
andonLoad
plugin API doesn't appear to respect the RegExp case-insensitivity flag.For example, the following will only match files ending in
.cpp
or.c
but not.C
or.CPP
even though thei
flag is specified at the end of the RegExp literal.I also attempted to use the
new RegExp('\.c(pp)?$', 'i')
form but it didn't work either. 😔The text was updated successfully, but these errors were encountered: