feat: support mixed glob and RegExp arrays in the ignored option - #336
Merged
Merged
Conversation
`ignored` now accepts `(string | RegExp)[]` so glob patterns and regular expressions can be combined in a single array.
🦋 Changeset detectedLatest commit: 596dc8c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
alexander-akait
approved these changes
Sep 9, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #336 +/- ##
==========================================
+ Coverage 91.91% 92.19% +0.27%
==========================================
Files 8 8
Lines 1299 1307 +8
Branches 384 385 +1
==========================================
+ Hits 1194 1205 +11
+ Misses 99 96 -3
Partials 6 6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Framework authors who wrap watchpack cannot merge their own ignore patterns with the user's when the two use different forms. If a user configures
ignored: /\.git/and the framework wants to append**/dist, there is no value that expresses both: an array is assumed to contain only glob strings, so putting aRegExpin it throwsTypeError: Expected a string.This is the underlying limitation behind web-infra-dev/rspack#10596, where rspack users hit the same wall through
watchOptions.ignored.What
ignoredToFunctionnow splits an array into glob strings andRegExpinstances. Glob strings are still merged into a singleRegExpas before; that combined pattern and any userRegExps are then tested against the separator-normalized path.Ignoredbecomes(string | RegExp)[] | RegExp | string | IgnoredFunction. Behaviour for string-only arrays, single strings, singleRegExps and functions is unchanged.