-
Notifications
You must be signed in to change notification settings - Fork 203
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
Passing options to chokidar #162
Comments
Regardless of what way is decided, it is clear that having a way to specify |
@zertosh I like 1.), but using the I think something along the lines of the following would be optimal:
How's that sound? |
Has anyone raised the issue of wanting to pass other options to chokidar other than |
I came here to open an issue on this; seems I don't have to. :) My (h|n)asty workaround is a var chokidar = require('watchify/node_modules/chokidar');
var origWatch = chokidar.watch;
// Monkey-patch chokidar.watch() to use polling:
// @see https://github.com/substack/watchify/blob/2.4.0/index.js#L83
// @see https://github.com/substack/watchify/blob/2.4.0/index.js#L98
chokidar.watch = function(file, opts) {
// @see https://github.com/paulmillr/chokidar#performance
opts.usePolling = true;
opts.interval = 500;
return origWatch.call(chokidar, file, opts);
};
// Proxy to the actual watchify "binary":
require('watchify/bin/cmd'); |
Also in the case of having to use polling I would assume it'd be hugely beneficial to be able to exclude certain paths, say, |
@tarsolya That sounds good, but the issue then becomes deciding which flag overrides which, or how to merge them. That's not a technical challenge but a UX one - one whose outcome will make someone unhappy for sure. I'm leading more towards mapping:
And take the remaining options on case-by-case basis. I'm generally apprehensive about expanding API surface area - anywhere.
@jonbretman: Nope just that and only because it's a solution to NFS watching - which is kinda common since everyone wants to run and develop their apps in containers. Passing
@jareware O_o wow heh. Thank you for sharing that snippet - it's clear that we need to support passing the polling option. Quick tip: since you're monkey-patching chokidar already, you can also pass in |
I'll come up with something in the next few days. I want to cut another 2.x release that resolves (1) listeners leak in cmd.js and (2) EPERM on windows, before introducing a 3.x release that bumps chokidar to 1.0.0-rc4 and allows passing (some) options (in some form). |
@zertosh Fair enough and I'm with you on keeping the API surface as tight as possible. I think what you proposed covers the majority of ignore use cases very well. And the custom ones ... well, they will have to be made custom anyway. 👍 |
@zertosh Ha, thanks for the tip! Also really looking forward to dropping the monkey-patching nonsense with an upcoming release. ;) |
Just published 3.0.0 (see #170). It has the options as I described them above. |
Wicked, thanks! |
There seem to be two ways to do this: (1) via something like a
opts.chokidar
, or (2) piecemeal options likeusePolling
,interval
andignored
.opts.chokidar
:opts.chokidar
is unique.--chokidar [ --usePolling --ignored '**/node_modules/**' ]
vs--usePolling --ignoreWatch '**/node_modules/**'
).The text was updated successfully, but these errors were encountered: