HMR not working
- I'm submitting a ... [ ] bug report
- What is the current behavior? HMR not works
- If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem git clone npm install node run start:hmr and change something in any component
- What is the expected behavior? working hmr
- Please tell us about your environment:
- Angular version: 2.0.0-rc5
- Browser: Chrome, firefox [dm@dm ~]$ npm -v 3.10.6 [dm@dm ~]$ node -v v6.4.0 Archlinux
- Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
Bug after update to rc5.
Chrome:
webpack-hmr.ts:89 Uncaught TypeError: Cannot read property 'nativeElement' of undefined
(anonymous function) @ webpack-hmr.ts:89hot
Apply @ bootstrap 294a89d…:456
hotUpdateDownloaded @ bootstrap 294a89d…:326
hotAddUpdateChunk @ bootstrap 294a89d…:306
webpackHotUpdateCallback @ bootstrap 294a89d…:27
(anonymous function) @ 4.294a89d….hot-update.js:1
Firefox:
TypeError: COMPONENT_REF.location is undefined
hotModuleReplacement/<()
vendor.bundle.js:65169
hotApply()
polyfills.bundle.js:458
hotUpdateDownloaded()
polyfills.bundle.js:328
hotAddUpdateChunk()
polyfills.bundle.js:308
webpackHotUpdateCallback()
polyfills.bundle.js:29
4.bcaccc3d807df08ae3c8.hot-update.js:1 vendor.bundle.js:65169:14
+1 same issue and same environment
I updated the repo a bit more. Can you check again? https://github.com/AngularClass/angular2-webpack-starter/commit/c7cf01c107afdcc457d265ac5ed3dea990f01381
Now worse then before.
main.browser.ts:49TypeError: Cannot read property 'state' of undefined at AppModule.hmrOnInit (http://localhost:3001/main.bundle.js:278:30) at http://localhost:3001/main.bundle.js:581:50 at ZoneDelegate.invoke (http://localhost:3001/polyfills.bundle.js:15454:30) at Zone.run (http://localhost:3001/polyfills.bundle.js:15347:45) at http://localhost:3001/polyfills.bundle.js:15713:59 at ZoneDelegate.invokeTask (http://localhost:3001/polyfills.bundle.js:15487:39) at Zone.runTask (http://localhost:3001/polyfills.bundle.js:15387:49) at drainMicroTaskQueue (http://localhost:3001/polyfills.bundle.js:15619:37) at HTMLDocument.ZoneTask.invoke (http://localhost:3001/polyfills.bundle.js:15559:27)
Right after page loaded
clean install
Can you try again
better. Error duaring apply hmr
Error: do not mutate the.statedirectly(…)(anonymous function) @ main.browser.ts:49ZoneDelegate.invoke @ zone.js:332Zone.run @ zone.js:225(anonymous function) @ zone.js:591ZoneDelegate.invokeTask @ zone.js:365Zone.runTask @ zone.js:265drainMicroTaskQueue @ zone.js:497
Also I think you forget delete console.log: app.module.ts:53 HMR store Object {state: Object}state: Object__proto__: Object__proto__: Object
Same problem here, someone has the solution? :confused:
ok sorry about that it should be fixed https://github.com/AngularClass/angular2-webpack-starter/commit/1afe8da4761788a683c2ef0e919b6d643fdf7039
Thanks for your quick response :smile: ! But I still have a problem, when I change some file (html, css or whatever) some text disappear ... and I need to reload my page to refresh the view. Some ideas? :confused:
Before

After I changed some file ...

Up ?
did you update your repo copy with the latest changes?
https://github.com/AngularClass/angular2-webpack-starter/blob/199bb8c0e3d345ec89ba9d3c179ca186bbc2e3db/src/app/app.module.ts#L49...L72
Also note how it works. I'm manually updating a store with the state then running change detection with ApplicationRef#tick()