What is the problem this feature will solve?
The new --watch flag will automatically restart the process when any imported file is changed.
The new related --watch-path flag will restart the process when one of the added paths change.
Using --watch-path disables the automatic restarting based on imported modules.
--watch is what you want 99% of the time, but there are cases where you want to extend the watched files ever-so-slightly.
One such example is .env when used with the dotenv module. No matter if you do it programmatically, or through the use of a -r flag to the node process, changes in the .env. file will not trigger a reload.
Other examples could be configuration files in json, yaml og toml formats.
What is the feature you are proposing to solve the problem?
A new flag which will allow extending the set of watched files based on what is imported/required, with specific non-js files which are loaded through non-discoverable methods, without disabling the automatic discovery of files.
The automatic discoverability of files to watch is a killer feature! Unfortunately not being able to add individual files to the watched set is preventing me from using it.
What alternatives have you considered?
I can keep using nodemon or the current --watch-path feature, but have to enumerate and eagerly watch all files that could possibly be loaded. But as --watch-path does not work on Linux it will likely have to be nodemon.
What is the problem this feature will solve?
The new
--watchflag will automatically restart the process when any imported file is changed.The new related
--watch-pathflag will restart the process when one of the added paths change.Using
--watch-pathdisables the automatic restarting based on imported modules.--watchis what you want 99% of the time, but there are cases where you want to extend the watched files ever-so-slightly.One such example is
.envwhen used with the dotenv module. No matter if you do it programmatically, or through the use of a-rflag to the node process, changes in the.env.file will not trigger a reload.Other examples could be configuration files in json, yaml og toml formats.
What is the feature you are proposing to solve the problem?
A new flag which will allow extending the set of watched files based on what is imported/required, with specific non-js files which are loaded through non-discoverable methods, without disabling the automatic discovery of files.
The automatic discoverability of files to watch is a killer feature! Unfortunately not being able to add individual files to the watched set is preventing me from using it.
What alternatives have you considered?
I can keep using nodemon or the current
--watch-pathfeature, but have to enumerate and eagerly watch all files that could possibly be loaded. But as--watch-pathdoes not work on Linux it will likely have to be nodemon.