-
Notifications
You must be signed in to change notification settings - Fork 640
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
Revisit the watch option and chokidar dependency #1227
Comments
A friendly ping on this! 👋 |
I'm hesitant to remove it altogether, as there are various tools that rely on nunjucks' built-in watch functionality. But I don't see any harm in moving it to |
Hey @fdintino! Thanks for the response. I poked around in other libraries that do things similar to this (primarily As I mentioned above,
You can see this happen for example when you install warning " > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0". This isn't ideal, because it makes it sound like you're expected to install Which brings me to But in I think no matter which path nunjucks takes, this would probably be a major version release to cushion the blow on any folks who are currently using it — a minor release could surprise someone even if it got moved to |
Any updates on this? Chokidar alone is almost the same size as the rest of Nunjucks and its dependencies. |
@MH15 ignore my comment in the other issue. You're right, I hadn't realized the optionalDependencies behavior was still causing this. As @rdmurphy explained in his very thorough comment above, it's a large enough change that it probably ought to be rolled out with a major release. The good news is that the plan for nunjucks v4 involves splitting some optional functionality into separate namespaced packages, e.g. |
Perhaps node-watch is a workable alternative? It's a simple, well-tested, dependency-free implementation of a recursive directory watcher. It was adopted by QUnit last year, and for the same reason (impractically large dependency graph). See also qunitjs/qunit#1342. Let me know if you're open to this, as I'd be interested in writing a patch for it. (Ref 11ty/eleventy#1375.) |
I would absolutely welcome a PR that switched from chokidar to node-watch! |
I don't have strong feelings on this, but when I originally added this issue is was right after Chokidar's But I think independent of which watcher is in use there's still the challenge of Another path here (which I think was added as a feature to |
I think it's fine to move chokidar to peerDependencies if it's part of a minor version bump. And you're right, chokidar@^3 looks much improved. I'm a bit bogged down at the moment with a few other tasks; would you be willing to open a PR with those changes? |
@fdintino Whoops, coming back around to this! Would it not be considered "breaking" if a user making a minor version upgrade suddenly had to install |
I think if we make the chokidar error message more helpful, we'd cause minimal disruption. This error would never really occur in production or a CI environment. If a developer starts a watch process and hits this error, the remedy is fairly straightforward. |
Sounds good. I’ll try and throw something together. |
Don't mean to be rude, but any updates? |
Finally took that swing at this here: #1329 |
Hello!
I was digging into what was inflating the install size of
nunjucks
and finally traced it down to thechokidar
dependency that's included inoptionalDependencies
. At one point (in #610) it was even discussed that nunjucks just get rid of this capability entirely — which I think is the right answer overall.(I got on this path when I was comparing Liquid JS to nunjucks and noticed how much tinier it was for similar capability, and it has everything to do with it bypassing the work of including a watcher.)
Even now as an optional dependency it's practically a guarantee that most people are still downloading it — it's uncommon for folks to pass in the
--no-optional
flag and AFAICT it's not documented as an installation method for nunjucks. I'd argue it'd perhaps make more sense as a peer dependency or... just not there at all. 😄I'd be happy to help make this a reality if there's still an appetite for it! Seems like something that could be re-created as a recipe/example of how to do it externally so people still have a path to accomplish this.
The text was updated successfully, but these errors were encountered: