Skip to content
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

Feature Request: Allow turning off watch() for files inside node_modules #2179

Closed
xunnanxu opened this issue Sep 25, 2016 · 4 comments · Fixed by #3797
Closed

Feature Request: Allow turning off watch() for files inside node_modules #2179

xunnanxu opened this issue Sep 25, 2016 · 4 comments · Fixed by #3797

Comments

@xunnanxu
Copy link

Environment Info

Hexo version 3.2.2

Plugin version(npm ls --depth 0)

Feature Request

Allow turning off watch() for files inside node_modules

Use Case

Right now it's easy to get too many open files error. The main reason is node_modules often contributes a lot of files. While understanding sometimes this is useful when updating code, this is generally unnecessary. Users should be allowed to filter out certain directories to be watched.

@ghost
Copy link

ghost commented Oct 12, 2016

I have exactly the same problem! It seems there was a fix commited some time ago:
4eaec8a

Retated Issue:
#1316

However, its still broken for me. :(

@darekkay
Copy link
Contributor

darekkay commented Jun 5, 2017

I've tried solving this problem with adding node_modules to skip_render, but unfortunatelly this doesn't make a difference :(

@SukkaW
Copy link
Member

SukkaW commented Sep 18, 2019

The feature seems to be added in #2631
The documents will update soon.

@SukkaW SukkaW modified the milestone: v4.0.0 Sep 18, 2019
@seaoak
Copy link
Member

seaoak commented Oct 24, 2019

I think #2631 does not resolve this issue.

#2631 is to exlude some dirs/files from visiting (=processing) only.

To prohibit Hexo from watching dirs/files,
the option ignored should be passed to chokidar.watch().
(Not ignore)

The calling chain is:

  1. chokidar.watch() is called by watch() of hexo-fs with its options parameter.
  2. watch() of hexo-fs is called by Box.prototype.watch() with this.options.
  3. this.options of Box is generated by the constructor of Box.

So, to resolve this issue, set the options.ignored of an instance of Box.

A patch (under development) for this issue was:
master...seaoak:feature/allow-turning-off-reading-and-watching-for-specified-directories

I will continue to update this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants