Skip to content

Conversation

Perfecto23
Copy link
Contributor

Summary

This PR implements support for mixed array types (string | RegExp)[] in watchOptions.ignored configuration. Previously, users could only use homogeneous arrays (either all strings or all RegExp), but now they can mix both types in a single array for more flexible file exclusion patterns.

Key Changes:

  • Updated TypeScript types to support (string | RegExp)[] instead of just string[]
  • Enhanced the ignoredToFunction logic to handle mixed arrays by type-checking each item
  • Updated Zod schema validation to accept mixed array types
  • Added documentation examples showing mixed array usage
  • Updated API documentation to reflect the new type signature

Example Usage:

// Now supported - mixing strings and RegExp
watchOptions: {
  ignored: [/\.git/, '**/node_modules', '**/.cache']
}

This change maintains full backward compatibility while providing users with more flexibility in configuring file exclusion patterns.

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

BTW, see this : #10596 (comment)

@Perfecto23 Perfecto23 requested a review from hardfist as a code owner July 16, 2025 15:20
Copy link

netlify bot commented Jul 16, 2025

Deploy Preview for rspack ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit cdeccf4
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6879b1eda5bf730008b45d67
😎 Deploy Preview https://deploy-preview-11073--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the release: feature release: feature related release(mr only) label Jul 16, 2025
- Support (string | RegExp)[] for watchOptions.ignored configuration
- Update type definitions to allow mixed arrays in WatchOptions
- Enhance ignoredToFunction to handle both string and RegExp items
- Update schema validation with Zod to accept mixed array types
- Add documentation examples for mixed array usage
- Update API documentation to reflect new type signature

This allows users to combine string patterns and RegExp objects
in watchOptions.ignored for more flexible file exclusion patterns.

Closes web-infra-dev#10596
@Perfecto23 Perfecto23 force-pushed the feature-support-mixed-array branch from f5a7ee7 to cdeccf4 Compare July 18, 2025 02:31
@GiveMe-A-Name
Copy link
Member

Rspack using watchpack as underlying watch tools. Maybe we need support watchpack receiver Array firstly.

https://github.com/webpack/watchpack/blob/main/lib/watchpack.js#L35-L40

@Perfecto23
Copy link
Contributor Author

Rspack using watchpack as underlying watch tools. Maybe we need support watchpack receiver Array firstly.

https://github.com/webpack/watchpack/blob/main/lib/watchpack.js#L35-L40

Yes, I thought so too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: feature release: feature related release(mr only)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: watchOptions.ignored support (string | RegExp)[] type
2 participants