I am bundling my lazy loaded modules in angular 2 rc6 with systemjs builder, when I run my app I see all non lazy loaded modules being downloaded (using fiddler) and that is because I import them in app.module.ts, but none of my lazy loading modules with "loadChildren" property in app.routing work, I see a white screen with "loading..." hanging there forever and the module is not being downloaded. this is my app.routing:
export const routes: Routes = [
{ path: '', redirectTo: '/strategies', pathMatch: 'full' },
**// NONE OF THE BUNDLES FOR FOLLOWING MODULES ARE BEING DOWNLOADED BY SYSTEM** JS
{ path: 'strategies', loadChildren: 'app/strategy/strategy.module' },
{ path: 'login', loadChildren: 'app/login/login.module' },
{ path: 'crises', loadChildren: 'app/crisis/crisis.module' },
{ path: 'heroes', loadChildren: 'app/hero/hero.module' },
];
export const routing = RouterModule.forRoot(routes);
this is my app.module:
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
routing,
CoreModule, ==> **THIS IS BUNDLED TOO AND SYSTEMJS DOWNLOADS IT UP FRONT**
HttpModule,
],
bootstrap: [AppComponent],
providers: [
{ provide: LocationStrategy, useClass: HashLocationStrategy },
],
})
export class AppModule { }
this is my bundles config in systemjs.config file:
bundles: {
'dist/index.js': ['app/*'],
'dist/shared/index.js': ['app/shared/*'],
'dist/core/index.js': ['app/core/*'],
'dist/crisis/index.js': ['app/crisis/*'],
'dist/hero/index.js': ['app/hero/*'],
'dist/strategy/index.js': ['app/strategy/*'],
'dist/login/index.js': ['app/login/*'],
'dist/dependencies.js' : [
'@angular/core/bundles/core.umd.js',
'@angular/common/bundles/common.umd.js',
'@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http/bundles/http.umd.js',
'@angular/router/bundles/router.umd.js',
'@angular/forms/bundles/forms.umd.js',
'angular2-in-memory-web-api/index.js',
'rxjs/*','rxjs/scheduler/*','rxjs/add/*','rxjs/add/operator/*','rxjs/observale/*','rxjs/add/observable/*',
]
}
Any hint would be appreciated.