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

Files passed to --ignore are also watched #9565

Open
dahjelle opened this issue Feb 22, 2019 · 5 comments · May be fixed by #11708
Open

Files passed to --ignore are also watched #9565

dahjelle opened this issue Feb 22, 2019 · 5 comments · May be fixed by #11708

Comments

@dahjelle
Copy link

Bug Report

Current Behavior
I was hitting an error message of "System limit for number of file watchers reached", and it turns out that this was because I was doing something like:

npx babel . --out-dir=../es5 --watch --ignore="node_modules"

But, since --ignore was not getting passed to chokidar, it was trying to watch the entire node_modules directory—hence the error!

Expected behavior/code
I would expect --watch to also respect the --ignore option.

Babel Configuration (.babelrc, package.json, cli command)

module.exports = {
  presets: ["@babel/env"],
  sourceType: "script"
};

Environment

  • Babel version(s): 7.3.3
  • Node/npm version: 10.15.1/6.8.0
  • OS: CentOS 7.5
  • Monorepo: no
  • How you are using Babel: cli

Possible Solution
I attempted but failed in a patch: #9559 This failed as chokidar uses globs for their --ignored flag and Babel uses RegExp.

Is there another way to avoid the issue? I recognize it is more usual to run babel against a src directory or the like…but one doesn't always have that luxury on legacy code.

Thanks!

@babel-bot
Copy link
Collaborator

Hey @dahjelle! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Feb 23, 2019

I think that chokidar's ignored option can be a function: we can reuse the same function we use to decide wether or not a file should be compiled.

@Kacppian
Copy link

Can I pick this up?

@danez
Copy link
Member

danez commented Feb 26, 2019

Sure feel free.

@barronwei barronwei linked a pull request Jun 11, 2020 that will close this issue
@steve-taylor
Copy link

--ignore also doesn't work when building

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.

6 participants