-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restart node.exe if dependent files are updated #58
Comments
I would support this - the default Node.js w/Express template in WebMatrix has this construct and every time you change routes.js you have to manually restart IISExpress. It's quite time-consuming... How about adding a listener to all *.js files in the same directory as the one named in web.config? Or doing as Kirill says and understanding the require() dependencies (I know this is probably much harder)? |
The fix is to add a new configuration attribute system.webServer\iisnode@watchedFiles. This is a semi-colon separated list of files that will be watched for changes. A change to a file causes the application to recycle. Each entry consists of an optional directory name plus required file name which are relative to the directory where the main application entry point is located. Wild cards are allowed in the file name portion only. For example, if the main entry point to an application is deployed to c:\apps\myapp\server.js, and the web.config contains the following:
Then changes to any of the following files will cause application recycle:
The default value of iisnode@watchedFiles is "*.js", which means that changes to any *.js files located in the directory with the application entry point (e.g. server.js) will cause application recycle. |
This doesn't seem to be working for me. |
Please elaborate. |
@rramachand21 when i deploy new files to my iisnode site, the app pool doesn't recycle. |
Whats your watched files setting? |
@rramachand21 *.js |
With the current implementation, watchedFiles will recycle node.exe if it detects changes to existing *.js files in your case. It will not detect new *.js files created. |
@rramachand21 I'm using teamcity to deploy all files. Everything is overwritten each time. Also, I tried changing a .js file by adding a few white spaces and saving. The app still did not recycle. |
I'm having the same problem as well... |
I just tried the "changing a .js file by adding a few white spaces and saving." and the node.exe recycles on the next request. Do you have a simple app that repro's this issue? |
btw, which version of iisnode are you using? |
@rramachand21 when the node process recycles, does it start a new log file? In any case, I have no new log statements from the app. How do I check the version of iisnode? |
in your app, print process.pid and if the pid changes, you know your node.exe has recycled. To check iisnode version, go to %programfiles%\iisnode\iisnode.dll, right click this->properties->Details -- check file version. |
@rramachand21 My version is 0.2.7. I have a fair amount logging that should print every time the app starts. Modifying the .js files does not cause any logging at all. |
Please give me a repro application as I am not able to repro with my setup and i am using 0.2.7 for my testing as well. Are you modifying *.js files in the same directory where the main script file is present. By main script file i mean the one you specified in your web.config as your entry point like server.js? |
@rramachand21 sorry for the late reply. Here's my
Here's my
When I change
nothing happens. |
For some reason this doesn't work for me too. Even when I want to make a change to a single |
My starting point for my app is in a 'bin' folder. How would I specify files in the parent folder of the entry point? Would I use something like: '../*.js' |
has there been a fix to this, as I am also facing the same problem. app.use('/api/roadmaps', roadmapsRouter); // Need to add a roadmapId as a paramater in the future app.get('/', function root(req, res) { app.listen(process.env.PORT || 3000); And my web.config looks like this
</system.webServer> This is a React based application and when i make a change to a any of my components under the path |
Currently, IISNode restarts node.exe if the associated .js file is updated. Pretty common my app consists of the main app.js and some module foo.js that app.js depends on (require('foo.js').
As I debug issues in foo.js, I often update it without updating app.js. I have to remember to restart IISNode. Could we either
a) provide an explicit descriptor of dependencies
or, better yet,
b) track the .js files we load at runtime and re-load node.exe if any of the loaded .js filed got updated.
?
The text was updated successfully, but these errors were encountered: