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

Ignore/exclude files/dirs from watch #1478

Closed
schickling opened this issue Jul 28, 2021 · 3 comments
Closed

Ignore/exclude files/dirs from watch #1478

schickling opened this issue Jul 28, 2021 · 3 comments

Comments

@schickling
Copy link

It would be great if it there was a way to exclude/ignore files and/or directory when using watch: true (e.g. node_modules).

Maybe this is already possible via plugins as well?

@evanw
Copy link
Owner

evanw commented Jul 28, 2021

This isn't possible with esbuild's built-in watch mode but it's trivial to use whatever external watch mode library you prefer instead of esbuild's built-in watch mode. Just turn off esbuild's watch mode and use incremental builds instead, then call rebuild() whenever your watch mode library detects a change.

@gustavopch
Copy link

I'd like this too. My use case is that I'm writing some stuff to the file system in onRebuild, so it triggers an extra rebuild that's not necessary:

  • Build runs
  • onRebuild writes a file
  • Build runs again but this time unnecessarily

@evanw
Copy link
Owner

evanw commented Dec 4, 2022

Since this issue was filed, esbuild has improved its watch mode to reduce the cases where rebuilds happen due to file system changes that are unrelated to the build: #1676. So I'm closing this issue both because you can bring your own watch mode if you choose, and because the situation has already been improved.

@evanw evanw closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants