asp.net-core – Working with JavascriptServices – Add Hot Module Replacement (HMR)

Hot Module Replacement allows to add, change or delete app module when application is running. Page reloading is not needed in this case.

Prerequisites

In addition to webpack-dev-middleware packages:

npm install --save-dev webpack-hot-middleware

Configuration

Simply update configuration of UseWebpackDevMiddleware with new options:

app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions()
{
    ConfigFile = "webpack.config.js", //this is defualt value
    HotModuleReplacement = true,
    ReactHotModuleReplacement = true, //for React only
});

You also need to accept hot modules in your app code.

HMR is supported for Angular 2, React, Knockout and Vue.

if you want to reproduce, please indicate the source:
asp.net-core – Working with JavascriptServices – Add Hot Module Replacement (HMR) - CodeDay