Exclude regular expression path should be OS neutral
See original GitHub issueThe regular expression in the exclude
property of a loader configuration can be used to exclude file paths, but the paths provided to the regular expressions are operating system dependent, e.g. on Windows the paths are in the form of “a\b\c” and on Unix-based operating systems “a/b/c”. This makes writing correct regular expressions more difficult (and especially to test them).
My proposal is to always supply paths in the Unix style to the regular expression (e.g. “a/b/c”), and to document this clearly.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Generating regex to exclude a string in path
What you could do is move the negative lookahead to the beginning to assert that what follows is not /debug or /debug/ :....
Read more >Regular Expressions Cheat Sheet by DaveChild
A quick reference guide for regular expressions (regex), including symbols, ranges, grouping, assertions and some sample patterns to get you started.
Read more >Untitled
The regular expression must satisfy following conditions. com ... This post will provide the regex for matching specific numbers of sub-directories in a...
Read more >User and Workspace Settings - Visual Studio Code
You can quickly clear a search term or filter with the Clear Settings Search ... the editor should remove adjacent closing quotes or...
Read more >Exclude or filter files using file type and regular ...
Certain files and file types can be globally excluded from a backup ... your backup using both file type and regular expression exclusions....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bebraw Any specific reason for closing this with a blunt ‘fix it yourself’?
To have projects handled correctly cross-platform, one needs to take care to write excludes either with obnoxiously bloated regexes like
or use the function syntax everywhere with custom path normalization strewn in, e.g.
Is that the kind of burden you should be placing on authors?
Webpack itself is in a position to offer a ‘OS-neutral’ POSIX path here — What users expect is being offered here in 99.999…% percent of all cases to begin with… — which will still be *nix-compatible and shouldn’t break the status quo.
Imho it’s downright negligent to do nothing and tell users to fix it themselves. Webpack is complicated enough without latent bugs being introduced into build configurations by implicit OS dependencies…
Hi, any update on this issue?