Disabling HMR on publishing the Asp.Net Core + Angular template to Azure RRS feed

  • Question

  • User-7611483 posted

    My project is the default ASP.NET Core + Angular project that you can find in Visual Studio, but with different modules of course. But the large part is still the same. I've noticed that on publishing to Azure, when I look in the console I still see errors saying it can't connect to `/dist/__webpack_hmr` and that I should enable angular prod mode. After checking `boot.browser.ts` I noticed this is because module.hot is not undefined. 

        if (module.hot) {


            module.hot.dispose(() => {

                // Before restarting the app, we create a new root element and dispose the old one

                const oldRootElem = document.querySelector("app");

                const newRootElem = document.createElement("app");

                oldRootElem!.parentNode!.insertBefore(newRootElem, oldRootElem);

                modulePromise.then(appModule => appModule.destroy());


        } else {



    I modified my startup.cs to this:

        if (env.EnvironmentName == EnvironmentName.Development)


            app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions


                HotModuleReplacement = true






            app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions


                HotModuleReplacement = false




    This seems to fix it locally, however when publishing module.hot is still not undefined, even though I do set HotModuleReplacement to false. I really don't understand how this doesn't work on Azure but does work locally

    Thursday, December 7, 2017 6:26 PM

All replies

  • User283571144 posted

    Hi arnvanhoutte,

    According to your description and codes, I couldn't find the reason why you got the module.hot is not undefined error.

    I have also create an asp.net core + angular project and publish it to azure. It works well.

    If possible, I suggest you could give us a project which we could reproduce your issue.

    It will be more easily for us to find the reason and solution to solve this issue.

    My test project:

    Best Regards,


    Friday, December 8, 2017 8:39 AM