alexisvincent / systemjs-hot-reloader

reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app
MIT License
228 stars 36 forks source link

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

Closed born2net closed 7 years ago

born2net commented 8 years ago

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

alexisvincent commented 7 years ago

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