nodemon: nodemon 1.17.2 not working, 1.17.1 ok
nodemon -v: 1.17.2node -v: 9.8.0- Operating system/terminal environment: Arch
- Command you ran: nodemon -e ts,js,tsx,jsx,jade --inspect=9229 ./bin/www
Expected behaviour
It working
Actual behaviour
Not working
Steps to reproduce
Simply try, maybe it only on Arch linux
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (5 by maintainers)
Commits related to this issue
- fix: node_modules watched off relative path Fixes #1294 Fixes #1305 (though couldn't confirm - just looks very similar) I've gone back and forth on this Chokidar option `cwd` and in this fix I've re... — committed to remy/nodemon by remy 6 years ago
- fix: node_modules watched off relative path (#1328) * chore: bump chokidar to latest * test: fix weird output on restart filename * test: skip old broken test * fix: node_modules watched off rela... — committed to remy/nodemon by remy 6 years ago
@gavinaiken +1 - I was trying to replicate this morning, but real/paid work took a priority. I’ll try to take another look again to work out what the right fix is.
Starting to get to the bottom of the issue. Looks like we have been using
nodemonincorrectly for a long time, but it was working anyway, although not doing exactly what we thought it was doing. The recent change has broken that behaviour.In more detail - we have always passed a glob pattern as the watch argument. Reading the README I see that it says not to do that, but to pass directories instead. i.e. we have been doing it wrong…
Our glob pattern is quite complex but I can reproduce the issue just with a simple glob pattern eg
If I run that, I see a debug output line like this:
where
/Users/gavin/repos/node-coreis the absolute path equivalent of../- i.e. nodemon is just ignoring the[A-Za-z]*/srcpart of the glob pattern. Fair enough, the docs do say not to use globs!The change in behaviour however seems to be that in 1.17.1 all the
node_modulesdirs under/Users/gavin/repos/node-coreare ignored. (There are several of them, and lots of module dependencies.) In 1.17.2 and .3, it is watching files in thenode_modulesdirs. This is despite it outputting this debug:which says it will be ignoring anything in those dirs. That seems to have been broken in 1.17.2.
So I need to expand my glob pattern before passing it in to nodemon as the watch args, which I think will resolve my issue, because I will then be watching subdirs with no
node_modules. But it looks like there is a bug in the latest that needs resolving to make it honor the ignores properly.