Angular2 cannot watch when using VSCode

2019-09-19 04:24发布

问题:

I am writing an Angular2 app and use angular-cli with the command ng serve to serve the app on localhost. This builds the app and serves it and also watches the code for changes.

This works fine and when I make any changes to the code and save, angular-cli detects the changes and rebuilds the code and refreshes the browser.

This works fine in about any editor I use except for VSCode. When making changes to the code and saving the code in VSCode, it saves the code, however, angular-cli does not detect the changes. I have to stop angular-cli from watching and manually do a rebuild.

How can I fix this ?

回答1:

I am working on angular 2 and VSCode for last 6 months and using angular-cli. but it works fine for me, may be you have some extenstions installed in VSCode which is causing this issue