alexisvincent/systemjs-hot-reloader

Add support for the new rc.5 angular2 lazy loading with hot-reload...

born2net opened this issue · 1 comments

Angular2 released this week new support for lazy loading and modules.
https://angular.io/docs/ts/latest/guide/ngmodule.html

And while it does work well with systemjs, it does not support lazy loading with hot-reload!
So if you make a change in a lazy loaded module, hot-reload does not reload the module nor the component that the change was made in...

I think all it would take is just to recognize that a component is part of the build process even though it's not in the source code. What angular2 does is use the router to load a component via a string, such as

const appRoutes: Routes = [{
    path: '',
    component: EntryPanel
}, {   path: 'LazyLoad',
        loadChildren: 'src/comps/app1/lazyone/LazyOneModule'
    }, {

notice that LazyOneModule is referenced simply as a string, and so obviosuly if a change was made, the local server does not know it needs to reload the related component...
A solution would be to somehow parse the router or to somehow via a "hack" let the local server and thus hot-reload force a reload of related component tree.

Regards,

Sean - http://DigitalSignage.com

@born2net If you still would like to champion this, please submit a failing test case to systemjs-hmr :)