PatrickJS/NG6-todomvc-starter

HMR Question

ElliotPsyIT opened this issue · 2 comments

Excuse the newbie question. I'm new to transpiling and bundling angular with webpack/ES6. I cloned and ran the project with no problems. But, I'm a bit puzzled about how Hot Module Reload works.

After entering a todo in the running app, I simply changed the title 'todos' to 'my todo' in app.component.js. I thought the title would update but the state of the app would be preserved. Instead the page fully reloaded and the app state was lost. Perhaps I have a naive understanding of the HMR system. Could I trouble you to briefly explain? Sorry this is a general question and not NG6 starter specific.

And thanks very much for this todoMVC app example of the NG6 starter. Great stuff!!

fesor commented

Hi, @ElliotPsyIT

As you maybe know, HMR is working by replacing modules. But if your framework (in our case it is Angular) doesn't allows you to replace components in runtime, you can't use HMR for it.

There was several attempts to make it possible by monkey-patching angular's modules system, but I don't know is anything working exists.

So currently HMR is used only to update styles.

Very good of you to take the time to answer. Much appreciated. And thanks again for the great NG6 starter!!