I’m developing a module in Node.js which I’ve npm-linked into another projects node_modules folder. I’d like to restart this other projects server upon file changes in my module. Nodemon ignores node_modules by default, but I assumed I could override this using nodemon --watch node_modules/my_module – but can’t get it to work. If I temporarily remove node_modules from Nodemons lib/config/defaults.js it works, which probably confirms that the problem has to do with overriding default behavior.
19.0, nodemon has inbuilt support for TypeScript files with help from ts-node that requires no manual configuration. By default, nodemon uses the node CLI as an execution program for running JavaScript files; for TypeScript files, nodemon uses ts-node as the execution program instead.
nodemon supports local and global configuration files. These are usually named nodemon. json and can be located in the current working directory or in your home directory. An alternative local configuration file can be specified with the --config option.
You don't need nodemon in production, nodemon it's only used for development purposes.
Using nodemon
1.2.1, I'm able to do the following to get watches working with an npm link:
$ nodemon --watch . --watch $(realpath node_modules/my_module)
Basically...you have to watch the directory you're in (your project directory), and then specify a watch to the symlink itself. nodemon
by default ignores node_modules
, so explicitly specifying the watch fixes this. You may try updating your version of nodemon
if this doesn't work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With