-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
fix: Matcher
for chokidar WatchOptions#ignored
#4616
Conversation
packages/vite/types/chokidar.d.ts
Outdated
@@ -117,7 +117,7 @@ export interface WatchOptions { | |||
* (the path), second time with two arguments (the path and the | |||
* [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path). | |||
*/ | |||
ignored?: any | |||
ignored?: string[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like ignored
can also be of type string
when only one entry is needed, or a regex. I don't find proper docs for it, maybe it is better to first send this change to chokidar so it is properly discussed there, and then we can port it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. But it seems to introduce another problem. we make the assumption that it is just an array. It will be throw error '/foo/ is not iterable'
if the user just writes ignore: /foo/
.
vite/packages/vite/src/node/server/index.ts
Lines 320 to 322 in eef51cb
const { ignored = [], ...watchOptions } = serverConfig.watch || {} | |
const watcher = chokidar.watch(path.resolve(root), { | |
ignored: ['**/node_modules/**', '**/.git/**', ...ignored], |
I will close this and open another PR to fix it. Thanks for all the guidance.
wow. Not expected PR(paulmillr/chokidar#1140) being merged immediately. |
any
with Matcher
for chokidar WatchOptions#ignored
The warning is killing me. I couldn't solve it by reading the warning and doc. Simply re-export it in ' types/chokidar.d.ts' doesn't solve the problem and I fail to find location of exporting warning types from |
any
with Matcher
for chokidar WatchOptions#ignoredMatcher
for chokidar WatchOptions#ignored
Description
Make type def more accurate.
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).