-
Notifications
You must be signed in to change notification settings - Fork 432
Description
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
The problem I'm facing is similar to these two already existing closed issues:
- Rebuild on assets change in "watchAssets" mode #1055
- Server restart / watch assets not working with non-ts files. #1136
I have definition / configuration files that are read by the application during its bootstrap phase which configures certain features of the application. Using the watchAssets option as described here does update the files in the distribution folder when they're changed, but since they're only picked up during the application bootstrap phase, this effectively does nothing (as the application requires a restart for the changes to take effect). I have to resort to manually restarting the server, or if the application is running inside a mounted docker container, changing a random bit of code so that nest start --watch restarts the application.
Describe the solution you'd like
Changing the behavior of watchAssets to do this would be nice, but I understand that this sort of change is not something others developers may want.
Since this is the case, introducing a new option to handle the restart could be a viable solution to the problem that does not break existing workflows.
An option along the lines of restartApplicationOnChange could be added wherever watchAssets is currently possible to be specified. When this option is set to true, the application will restart if the asset is changed.
This would also give the developer the ability to more finely control when the application requires a restart should they need it.
Something that would fall out with this change would be the inconsistency of "watch" options :
--watchwill restart on code changes,watchAssetswill not restart on asset changes,- but specifying
restartApplicationOnChangealongsidewatchAssetswill restart on asset changes
Perhaps restartApplicationOnChange could be considered as being false by default, and later changed to true by default with a major release. This would resolve the inconsistency of "watch" options while still providing a method for developers to go back to using their old workflows (no restarts on asset changes).
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
Already explained in the first section, but in short:
I have configuration files that are read during bootstrap and only during bootstrap. A restart of the application is required in order to actually apply the changes that were made.