Angular CLI wiki: HMR docs are out of date
See original GitHub issueš Docs or angular.io bug report
Description
Angularās HMR (hot module replacement) docs are old and the steps donāt work anymore with @angularclass/hmr
.
https://github.com/angular/angular-cli/wiki/stories-configure-hmr
I spent a lot of time to get HMR to work based on the official Angular docs but it seems like these steps donāt work anymore. Not sure if Webpack has changed its API or @angularclass/hmr
but the current steps in the official Angular docs donāt work anymore and the new steps that are documented in the original @angularclass/hmr
docs work pretty well.
These 2 comments explain the simplest solution to get HMR to work with the latest Angular, Webpack and @angularclass/hmr
:
https://github.com/PatrickJS/angular-hmr/issues/81#issuecomment-449999297
https://github.com/PatrickJS/angular-hmr/issues/81#issuecomment-450028896
Simplest working solution (written by @Epono), anyone can clone and run it: https://github.com/Epono/angular-7-hmr
š¬ Minimal Reproduction
Just follow the steps in the official Angular docs on a new Angular project ng new test-app
and it wonāt work.
Whatās the affected URL?**
https://github.com/angular/angular-cli/wiki/stories-configure-hmr
Reproduction Steps**
Just follow the steps in the official Angular docs on any new Angular project ng new test-app
and it wonāt work.
Expected vs Actual Behavior**
Expected: When a source file changes Webpackās HMR picks up the changes and communicates it to the browser. Ideally it should refresh part of the page but at least it should display the fact of change in the console.
Actual: When the page is loaded in a browser (with ng serve --configuration hmr
and a source file is changed (and saved) Webpack doesnāt do anything, it doesnāt load any new file over the network and it doesnāt display any change in the browser console, thereās no error in the browser console or the terminal.
š Your Environment
Any new Angular install (ng new test-hmr-project
)
Browser info
This isnāt a browser specific issue
Anything else relevant?
Probably caused by updated Webpack API or updated @angularclass/hmr
API which isnāt reflected in the old (Aug 2, 2018) official Angular docs
Issue Analytics
- State:
- Created 5 years ago
- Reactions:13
- Comments:11 (6 by maintainers)
Note that the wikiās source (which isnāt in sync with the actual wiki) is found here: https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/configure-hmr.md
Also note that that source has the following:
Also please note that the Angular CLI GitHub Wiki is no longer the āofficial Angular docsā for the Angular CLI as mentioned on the wiki landing page:
And finally, it should be noted that there are no HMR docs for Angular version 7.
It would be helpful, as there is lots of interest, for someone to write a blog post that could later be turned into a PR to the official docs.
Also, hopefully the docs make it clear how to use HMR with Lazy Loading.
If Angular 8 is going to push dynamic importing, as well as Lazy Loading and not make it clear how to put it all together, thatād be extremely lackluster.