Watch mode and Hot Modules Replacement

If the HotModuleReplacement property of the option object is set to true, WebPack is invoked in watch mode and with Hot Modules Replacement (HMR) on. Accordingly, WebPack would look for changes in the sources it processed to creates all bundles, and when any change is detected it takes care of sending a patch to update all assets on the client side. 

For HMR to work properly, WebPack must be informed on the path of the web server that will be used to serve its bundles, in our case the dist/ path (that is, all bundles are served from http://localhost:<port number>/dist/). This information must be placed in the publicPath property of the WebPack configuration output option object, as shown:

...,output: ...

Get Hands-On TypeScript for C# and .NET Core Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.