Parcel: 馃檵 Replace chokidar with fb-watchman

Created on 20 Feb 2018  路  11Comments  路  Source: parcel-bundler/parcel

Choose one: is this a 馃悰 bug report or 馃檵 feature request?

chokidar only supports native file-system notification for MacOS (a limitation because it relies on fsevents).

watchman provides efficient fs notification for all platforms. Watchaman is used by the react-native bundler, which seems to work pretty well.

Help Wanted Feature RFC

Most helpful comment

I'm not sure it's worth switching as installing watchman to enable the watcher would sort of defy the whole zero-config experience.

On the other side however, we could create a simple adapter in between our watcher code and chokidar and watchman, and switch according to what exactly is installed. If i'm not mistaken, watchman's node mappings have a function that checks what version is installed. If no watchman is found we could always fallback to chokidar with polling to ensure 100% accuracy, but poor performance. (and add watchman install instructions to docs for optimal performance of the watcher)

I have not experimented enough with watchman to be able to say if it's even that much better than chokidar in the first place (it might not be worth it)

All 11 comments

Interesting. Are there nodejs bindings that don't require installation via brew or another package manager but just via npm?

If someone wants to experiment with this, it looks cool!

I think this a really interesting idea. Totally agree with @devongovett here, we should definitely experiment with this 馃憤

I found that for some reason it鈥檚 a bit hard to find information on google about using watchmen with Node-JS (I guess it was primarily designed to be used elsewhere), so here are some useful links:

Watchmen NodeJS Docs
Watchmen NPM Package

From the webpack-watchman-plugin readme:

Make sure watchman is installed and ready to use on your system.

You have to install it on your machine on your own for the plugin to work. This is going to be the biggest barrier to switching.

I'm not sure it's worth switching as installing watchman to enable the watcher would sort of defy the whole zero-config experience.

On the other side however, we could create a simple adapter in between our watcher code and chokidar and watchman, and switch according to what exactly is installed. If i'm not mistaken, watchman's node mappings have a function that checks what version is installed. If no watchman is found we could always fallback to chokidar with polling to ensure 100% accuracy, but poor performance. (and add watchman install instructions to docs for optimal performance of the watcher)

I have not experimented enough with watchman to be able to say if it's even that much better than chokidar in the first place (it might not be worth it)

Oh wow I didn鈥檛 realize it would require a separate install, that鈥檚 super annoying. I like @DeMoorJasper鈥檚 idea, but all this adds a huge unforeseen layer of complexity that will probably bring little benefit.

I think for now we should just make a super basic implementation that just assumes it鈥檚 already installed, and then run perf tests on that to see if Watchmen even brings any benifits in the first place.

Whoops wrong button... reopening

I would try a barebones implementation first, then if you see performance benifits maybe actually implement that whole thing.

Hey guys,
that's really annoying with watchman...
Basically it is build as a service which you have to install at your OS first.
Afterwards you can npm install fb-watchman to get the NodeJS client working, which consumes this service. Really no one wants out-of-npm installs for node apps to be working 馃槺

Node Sentinel File Watcher NSFW provides proper bindings and is a much better alternative to chokidar 馃帀
https://github.com/Axosoft/nsfw/issues/18

@AndyOGo I tested nsfw in a multitude of environments ranging from home to smallish enterprise and I found a couple problems:

  1. Works only with Node LTS 8.11.3 version (node-gyp build fails on newer major versions)
  2. Does not provide pre-compiled platform libraries - just C++ source files. Not everyone has a compiler pre-installed (I have, didn't realise this before convincing 2 dozens win-based developers to try it for me)
  3. Requires python installed. This shoots back to @DeMoorJasper's comment.

@deniskabana
I see. Thanks for testing it.
So I guess both come with their downsides and upsites 馃

Both alternatives to chokidar, watchmen and NSFW seem to need locally installed packages to work.
@DeMoorJasper said that this would not comply to the zero-configuration approach and everyone else agreed.
Leaving the issue open seems pointless to me at the moment.
Anyone against closing it?

Was this page helpful?
0 / 5 - 0 ratings