Last post Oct 19, 2017 08:23 AM by TonyHelp
Oct 17, 2017 09:11 AM|proskilly|LINK
I have a asp.net core 2 web app (against full .net framework) that I created using the Angular SPA template is VS2017. I have added in lots of controllers, views & models.
Whilst everything works including the page on the website containing the angular app - that is functional.
However the problem is when I made changes to the angular code it is just ignored. I have added a new component and changes the routing a bit but no matter whether I press F5 to run the project, or compile the the project (in debug or release) it just doesn't
use the latest angular source code and carries on using the old version.
No errors are showing up anywhere, I don't know where to start looking.
I have a different asp net core 2 web app that uses angular and that one works ok, but i can't see the difference between the 2 (except that one targets the .net core framework rather than full .net framework).
Oct 17, 2017 10:10 AM|mgebhard|LINK
Try pressing ctrl-F5 in the browser to refresh all file references.
Oct 17, 2017 10:43 AM|kashyapa|LINK
Oct 17, 2017 02:06 PM|bruce (sqlwork.com)|LINK
Oct 18, 2017 11:56 AM|proskilly|LINK
@mgebhard Pressing ctrl + F5 doesn't help, the files in the wwwroot/dist directory (where the compiled angular stuff is) doesn't update.
I have found a work a round which is to just delete the dist directory and then compile the Visual Studio project and the dist directory gets updated with the latest compiled angular app, however ideally it is supposed to check for changes in ts files and
do all of this automatically.
Oct 18, 2017 12:00 PM|proskilly|LINK
If I run webpack -d in Visual Studio Package Manager console in the directory where webpack.config.js is i get this error message :
webpack : The term 'webpack' is not recognized as the name of a cmdlet, function, script file, or operable program.
However if I delete the dist folder and compile the project the angular app gets compiled then without any errors, I think the problem must be whatever is supposed to trigger off the webpack on file changes isn't kicking in.
Oct 19, 2017 05:17 AM|Edward Z|LINK
Could you share us your demo project and detail steps, and then we will try to reproduce your issue?
Oct 19, 2017 08:14 AM|proskilly|LINK
Thanks everyone for trying to help.
I managed to get HMR (hot module replacement) working, this was missing :
HotModuleReplacement = true
in Statup.cs, Configure() method in the if (env.IsDevelopment()) block.
Now whenever I make a change to one of the angular source files and save it the files in wwwroot/dist get automatically updated.
Oct 19, 2017 08:23 AM|TonyHelp|LINK
Thanks for sharing the solution.
I would suggest you mark your reply as answer which is the way to close a thread here.