-
Notifications
You must be signed in to change notification settings - Fork 433
HMR not working? #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Apologies for that, webpack can definitely be a bit much sometimes but it gets easier with time no worries! If you're running the project from command line with dotnet run make sure you set your environment variables to Development (otherwise things like HMR won't work). # on Windows:
set ASPNETCORE_ENVIRONMENT=Development
# on Mac/Linux
export ASPNETCORE_ENVIRONMENT=Development That's strange though, you're saying this is happening when just hitting F5 from even VS2017? |
Yes, I have exported the variable before running |
I haven't tested it but I noticed this was commented out - might want to try uncommenting: https://github.com/MarkPieszak/aspnetcore-angular2-universal/blob/master/Client/main.browser.ts |
That might be a part of it 🙈 |
Uncommenting the lines works, with a modification. Instead of:
I looked at the old file and changed this back to:
I don't know if this has implications, if not I will create a PR. |
I also commented out HMR for AOT compilation because of that. I have not done it like you because as I thought platformBrowserDynamic() would create new instance of that class. Or it returns same reference? |
I don't see why ngtools does not support providing it with 2 boot files - for aot and jit. |
I think this is because the vendor stuff is now included as part of the normal bundle. In previous versions this was separated, but more complicated as well (from the configuration point of view). May be this could be considered to be re-implemented, at development time this saves "hours" - feels kinda :-) |
Oh definitely, vendor chunking will definitely be added back in! I'm hoping to have some free time Friday to spend a few hours finishing all the remaining issues/upgrades here. If anyone wants to take a stab at the vendor chunking feel free until then! Just make sure it works for AoT etc as well. |
Can it be defined just as separate entry point or it must be in separate config file with dll plugin? |
@heqiao Changing I still seem to get a bit of a delay with just the devtool change. However I think the change I made to switch back to I made the change not to use ngtools for dev builds at least because I wanted two build multiple angular apps within solution and have HMR working aspnet/JavaScriptServices#566. I can't use ngtools because of angular/angular-cli#5072. |
@mcm-ham Changing to |
We can set it up to do ATLoader and such for development and ng tools for prod, but it just ups the difficulty and maintability for most devs, as things now need to be added and maintained in more than one place. Is that something we want though? Up to you guys. |
@heqiao Try changing webpack.server.js as well. Here are my numbers:
Turns out it was fast with my changes before because I had disabled SSR, changing to |
@mcm-ham That does the trick! Down to 1 sec with a brand new copy of the repo. Thank you for the help! 😄 |
Hi. for me hmr does not works. I did uncommented https://github.com/MarkPieszak/aspnetcore-angular2-universal/blob/master/Client/main.browser.ts |
@consigliory I uncommented but didn't change that line of code. When you run |
hmr is alive and have active event stream but on file change nothing happens. |
Might be a multitude of different things, do you have some repo we can take a look at? |
So I didn't realize I had that code uncommented, so I just pushed it back in :) @mcm-ham Did you want to put in a PR to add those speed improvements? Would be greatly helpful for others! 🎁 |
@MarkPieszak Is there any way we can speed up the HMR? It is quite slow. I know there is a hell of a lot going on to be fair but it can sometimes take 20 seconds. |
Mainly because Vendor isn't separated so it's recompiling everything, I'll add in the vendor chunking & polyfill chunking and maybe DDL support to really help speed things up! I just stopped working on all that since there were bigger fish to fry for a bit :) |
Thanks for the quick reply @MarkPieszak, that makes complete sense. I am going to have to have a mess around with webpack to get a better understanding of its workings. |
I would recommend disabling webpack recompilation for node during development. |
Closing this as HMR is working with latest code base |
I have problems with the updated version since splitting the monolithic webpack.config into multiple files. HMR seems to be broken. I say "seem" because I am clearly no expert on WebPack, but I had to revert my project back to the last version I pulled a few days ago. Here is what I get:
I am working on Windows (damn) and use Visual Studio 2017 but I can replicate this result on my Mac. The image taken is after pulling the repo and just run it from VS or
dotnet run
.I tried my best to get down to the cause but my knowledge of WebPack .. de facto does not exist. Too much has changed in the config file(s) and I get lost digging into the new ones :(
Anyone else having this issue?
The text was updated successfully, but these errors were encountered: