-
Notifications
You must be signed in to change notification settings - Fork 518
Problems with webpack and HMR #422
Comments
Are you using VSCode, Visual Studio 2015? What version of Node do you have installed? How are you running the project, F5 in VStudio, or |
Hi. All useful information! I've updated the question, but in summary it's Visual Studio 2015 (Update 3) running with F5. Node v4.6.1, Webpack 1.12.14 (in visual studio, I haven't edited the package.json) and 1.13.3 globally. NPM is version 3.10.8. |
Just to check, you're setting |
I had tried to check this after some googling. The following is in
And I also checked the
If I break after this I can inspect the config object and I can see the following environmental variables:
Further confirmation, if I break in Startup.cs Startup method:
I can see that |
Are you running from the command line? Not sure what OS you're running, but I'll give an example on windows.. To run one of the examples I open up a command prompt, cd my way to the project directory, then type |
Sorry, running on Windows 7, via Visual Studio 2015 Debug (or not with ctrl-F5). I just tried it from comand line using
However, the webpage at |
This will happen to me if i run webpack from command line, so try deleting dist/main-client.js for the in-memory serving of files to start to kick in again, and you will have hot-reloading as well. |
If you're running in development mode, then the webpack dev middleware will handle requests for If you can repeatably reproduce a scenario where deleting that file does make a difference (in development mode), please post repro steps! |
I wonder if this could just be the browser reusing a cached copy of |
I thought this work and started writing an answer, then tested it further and I can't reproduce it. I definitely saw HMR once, but I'm not sure what exactly caused it. I restart the server with
It recompiles the webpack. Latest main-client.js is used. Now, I need to refresh the web-page so it connects HMR:
However, making a change and saving a file does not result in a webpack compile. Just:
If I delete main client, it is not replaced by webpack. Also worth noting, that the above node restart is only applied once - further changes result in no similar message unless I refresh the page - then the next single change will result in the same. The only time it triggers a webpack compile is after just starting the server. Also, it seems the server side rendering is not updated when using Chrome cache doesn't seem to be the issue (though I tried it!), the main-client.cs file is simply not updated/produced. Thanks for the help. I'm going to try reinstalling node, and maybe on another machine, There must be some issue with my node install or something? I still think it's strange that it takes so long to compile the webpacks. Previously it was almost instantaneous (with the vendor taking about 7 or 8 seconds) but now the handful of typescript files take that long and the vendor near a minute. |
Okay! I've fixed it. Seems there was an issue with the node install. I installed the latest version (v6.9.1) and NPM. Interestingly, with visual studio I can only make one change but when I open it in visual studio code it works with multiple changes. Also, it only works with Thanks for the help, how do I close this? It was clearly a problem with my platform rather than the template. |
When you check your Visual Studio 2015, make sure $(PATH) is at the top for Node. https://ryanhayes.net/synchronize-node-js-install-version-with-visual-studio-2015/ Visual Studio comes with a much older version of Node installed that takes precedent usually. |
Glad you sorted it out! I'll mark this closed. @MarkPieszak I'm not sure how VS's usage of Node would have any effect on what happens at runtime. What's your theory about what's going on? |
I'm honestly not sure, pretty puzzled by this one! I just assumed the older version might not be handling it right, but the fact that it works once and then stops, is very strange... |
I am also facing the same issue. |
I had the same issue as @mageshbala90, where an isolated, fresh project would work, but it would break as I moved the project into a solution. I think what caused the problem was that the existing solution was on a different path, so when I moved my angular/hmr project, it took on a new path but the .vs folder inside had settings referencing the old path. I deleted the .vs folder, as well as bin, obj, and Properties. I opened the solution with VS2017, built, and let it regenerate all that stuff. HMR was then working again. |
additionally this warning in console: Template parse warnings: |
`emplate parse warnings: |
Is anyone else having this problem in 2017? Running:
NPM packages worth noting: |
Hello Is there anyway that Angular Webpack HMR work with Asp.Net MVC simple application not with Asp.net Core? |
@maulin-agsft Sorry, the code in this repo doesn't support that. |
I am having similar issues. Here's a repo with the the simplest-possible app I could think of to demonstrate the problem. https://github.com/jessegavin/dotnet-webpack-hmr It doesn't work for me on either MacOS nor Windows The really strange part is. There are some apps that DO work on my mac. I cannot figure out what I am missing. I am sure ASPNETCORE_ENVIRONMENT = Development |
Please follow Webpack docs. I don't see any reference to |
Thank you very much @SteveSandersonMS. I just realized how many assumptions I was making. I appreciate your help. |
I'm having issues with HMR in Visual Studio 2015 (Update 3, running with ctrl-F5), but I think the issue is with webpack. I've just created a new .NET Core Angular 2 template from scratch. It runs fine, however when I make any changes these aren't applied. I've not made any changes to the settings, so I'm using the following versions (from package.json):
I'm using Node version 4.6.1:
NPM version 3.10.8:
For manual building I installed webpack globally using
npm install -g webpack
following the guide here. It's version 1.13.3 (as seen in compile output below)There's a couple of things I've noticed.
This doesn't seem right.
Even if I refresh the page, the changes are not applied. I have noticed however that the server-rendering has the change, but then this is quickly replaced by an unmodified main-client.js. Here's an example:
<h1>Hello, world!</h1>
to<h1>Hello, world! Change</h1>.
webpack --config webpack.config.js
The only solution I've found is to close the browser, re-build with visual studio and re-launch the IIS server. I cant find any settings to configure the webpack process, so I'm struggling to find out what's wrong and why it isn't working.
The text was updated successfully, but these errors were encountered: