Closed puchm closed 3 years ago
Hey, thanks. I don't think this is intentional. I believe the intention was to have the server restart on some file changes (like assets that may be cached), but not trigger babel. It doesn't seem that this is really usable for that purpose.
I haven't had time to dig through it, maybe you have, but I would consider renaming or repurposing some of these flags.
Just noticed this issue is still open. I don't have a lot of time to dig into this other than renaming these flags.
What is the difference between --ignore
and --exclude
?
If someone can explain that to me I could try to come up with more appropriate names or put an explanation into the readme.
So:
--ignore
will watch the file, but not transpile it with Babel--exclude
will not watch the file at all and thus it won't be transpiled either.I don't actually see a good use case for --ignore
because I assume that if you actually have this need, you already have it set in your babel config. There shouldn't be a need for a unique ignore list only when using babel-watch
, but perhaps someone else has a different idea?
In this case I think the names are actually quite fitting. How about adding this explanation to the readme?
It's technically already there, but not super clear, so I'll add an additional note.
Hi, I noticed that
--exclude
is far superior to--ignore
in terms of startup performance. This is the startup command I used:It all works once it starts up but it always takes about a minute to do so. I tried switching
--ignore node_modules
to--exclude /app/node_modules
(which is the absolute path to mynode_modules
folder) and this improved it to about 10 seconds.I looked into the source code and I think I know what is going on:
The watcher gets started on all files except what's inside
--exclude
(see this line). I think anything that matches--ignore
should also be excluded. This way it wont start watchers on the wholenode_modules
folder if the user makes use of--ignore
instead of--exclude
.If that is not possible it should be communicated clearly in the readme that
--exclude
is better in terms of startup performance and what is the difference between--exclude
and--ignore
(to be honest, I don't fully understand it). Also, the node_modules folder should be the default for the--exclude
option rather than the--ignore
option.Thank you for improving this in advance! Moritz