WebpackHotUpdate not defined Angular 2+

Viewed 281

Recently when building our application my team and I came across an error with webpackHotUpdate.

What currently happens is we build and run the application using Local settings in Visual Studio. The working app opens as usual and everything works. However when we apply a change while the app is running. You can see a save was registered as the console window runs however the browser does not refresh. When one refreshes the browser window the change is not registered and the following error appears in the console:

Error 1

This is linked to this file in the console:

Error 2

None of my research online seems to help. I am fairly new to Angular as well so I really am stuck now.

Does anyone have any suggestions that might help me out? Thanks in advance.

1 Answers

This happens only when you try to run Angular CLI also from Visual Studio 2017.This looks like a problem in the way Visual Studio 2017 performs the HMR (Hot Module Replacement) process. There are two options i tried

  1. Disable HMR ny removing the switch from ng serve in package.config
  2. Run the Angular CLI separately

I chose the second option as HMR was important for me.

Related