{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular-cli/issues/6246","repository_url":"https://api.github.com/repos/angular/angular-cli","labels_url":"https://api.github.com/repos/angular/angular-cli/issues/6246/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular-cli/issues/6246/comments","events_url":"https://api.github.com/repos/angular/angular-cli/issues/6246/events","html_url":"https://github.com/angular/angular-cli/issues/6246","id":227500464,"number":6246,"title":"Angular 2 lazy loading compiling error","user":{"login":"stefanantic7","id":20440721,"avatar_url":"https://avatars3.githubusercontent.com/u/20440721?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanantic7","html_url":"https://github.com/stefanantic7","followers_url":"https://api.github.com/users/stefanantic7/followers","following_url":"https://api.github.com/users/stefanantic7/following{/other_user}","gists_url":"https://api.github.com/users/stefanantic7/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanantic7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanantic7/subscriptions","organizations_url":"https://api.github.com/users/stefanantic7/orgs","repos_url":"https://api.github.com/users/stefanantic7/repos","events_url":"https://api.github.com/users/stefanantic7/events{/privacy}","received_events_url":"https://api.github.com/users/stefanantic7/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-05-09T21:15:46Z","updated_at":"2017-05-15T17:49:56Z","closed_at":"2017-05-10T12:12:03Z","body":"I am trying to implement lazy loading. I am pretty sure that I put right path to VideoModule, but I still get an error on compiling.\r\n\r\nHere is my AppModule where I define my routes and module I want to load lazily.\r\n\r\n`\r\nimport {BrowserModule} from '@angular/platform-browser';\r\nimport {NgModule} from '@angular/core';\r\nimport {HttpModule} from '@angular/http';\r\n\r\nimport {AppComponent} from './app.component';\r\nimport {MenuComponent} from './menu/menu.component';\r\nimport {RouterModule} from '@angular/router';\r\nimport {HomeComponent} from './home/home.component';\r\nimport {VideoModule} from './video/video.module';\r\n\r\n@NgModule({\r\n    declarations: [\r\n        AppComponent,\r\n        MenuComponent,\r\n        HomeComponent,\r\n    ],\r\n    imports: [\r\n        BrowserModule,\r\n        HttpModule,\r\n        VideoModule,\r\n        RouterModule.forRoot([\r\n            {path: '', component: HomeComponent},\r\n            {path: 'video', loadChildren: 'app/video/video.module#VideoModule'}\r\n        ])\r\n    ]\r\n    bootstrap: [AppComponent]\r\n})\r\nexport class AppModule {\r\n}`\r\n\r\nand VideoModule\r\n\r\n`import {NgModule} from '@angular/core';\r\nimport {CommonModule} from '@angular/common';\r\nimport {VideosComponent} from './videos/videos.component';\r\nimport {VideoPlayComponent} from './video-play/video-play.component';\r\nimport {NamePipe} from './name.pipe';\r\nimport {VideoFilterPipe} from './video-filter.pipe';\r\nimport {FormsModule} from '@angular/forms';\r\nimport {RouterModule} from '@angular/router';\r\nimport {VideoPlayGuard} from './video-play.guard';\r\nimport {VideoService} from './video.service';\r\n\r\n@NgModule({\r\n    imports: [\r\n        CommonModule,\r\n        FormsModule,\r\n        RouterModule.forChild([\r\n            {path: 'videos', component: VideosComponent}\r\n        ])\r\n    ],\r\n    declarations: [\r\n        VideosComponent,\r\n        VideoPlayComponent,\r\n        NamePipe,\r\n        VideoFilterPipe\r\n    ],\r\n    providers: [\r\n        VideoPlayGuard,\r\n        VideoService\r\n    ]\r\n})\r\nexport class VideoModule {\r\n}`\r\n\r\nErrors I get:\r\n` 13% building modules 27/38 modules 11 active ...v\\pfilter-web\\node_modules\\url\\url.jsError: No module factory available for dependency type: ContextElementDependency\r\n    at Compilation.addModuleDependencies (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:206:21)\r\n    at Compilation.processModuleDependencies (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:195:8)\r\n    at _this.buildModule.err (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:335:13)\r\n    at building.forEach.cb (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:140:27)\r\n    at Array.forEach (native)\r\n    at callback (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:140:13)\r\n    at module.build (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:167:11)\r\n    at ContextModule.<anonymous> (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\ContextModule.js:118:3)\r\n    at ContextModule.result.resolveDependencies (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@ngtools\\webpack\\src\\plugin.js:229:25)\r\n    at ContextModule.build (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\ContextModule.js:99:7)\r\n    at Compilation.buildModule (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:142:10)\r\n    at factoryCallback (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:324:11)\r\n    at C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\ContextModuleFactory.js:96:12\r\n    at C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\tapable\\lib\\Tapable.js:204:11\r\n    at done.then (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@ngtools\\webpack\\src\\plugin.js:231:28)\r\n 14% building modules 38/42 modules 4 active ...angular\\common\\@angular\\common.es5.jsC:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:264\r\n                                if(_this.profile) {\r\n                                        ^\r\nTypeError: Cannot read property 'profile' of null\r\n    at factoryCallback (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:264:13)\r\n    at C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\NormalModuleFactory.js:242:4\r\n    at C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\NormalModuleFactory.js:93:13\r\n    at C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\tapable\\lib\\Tapable.js:204:11\r\n    at NormalModuleFactory.params.normalModuleFactory.plugin (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\CompatibilityPlugin.js:52:5)\r\n    at NormalModuleFactory.applyPluginsAsyncWaterfall (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\tapable\\lib\\Tapable.js:208:13)\r\n    at onDoneResolving (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\NormalModuleFactory.js:68:11)\r\n    at onDoneResolving (C:\\Users\\Stefan Antic\\Dev\\pfilter-web\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\NormalModuleFactory.js:189:6)\r\n    at _combinedTickCallback (internal/process/next_tick.js:73:7)\r\n    at process._tickCallback (internal/process/next_tick.js:104:9)`\r\n\r\n\r\nHere is my repo:   [https://github.com/stefanantic7/pfilter](url)\r\nSorry for a lot of code, but I tried  a lot of solution but it still does not work. I really do not know what else to do. "},"comment":{"url":"https://api.github.com/repos/angular/angular-cli/issues/comments/301551301","html_url":"https://github.com/angular/angular-cli/issues/6246#issuecomment-301551301","issue_url":"https://api.github.com/repos/angular/angular-cli/issues/6246","id":301551301,"user":{"login":"luchillo17","id":9698639,"avatar_url":"https://avatars1.githubusercontent.com/u/9698639?v=3","gravatar_id":"","url":"https://api.github.com/users/luchillo17","html_url":"https://github.com/luchillo17","followers_url":"https://api.github.com/users/luchillo17/followers","following_url":"https://api.github.com/users/luchillo17/following{/other_user}","gists_url":"https://api.github.com/users/luchillo17/gists{/gist_id}","starred_url":"https://api.github.com/users/luchillo17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luchillo17/subscriptions","organizations_url":"https://api.github.com/users/luchillo17/orgs","repos_url":"https://api.github.com/users/luchillo17/repos","events_url":"https://api.github.com/users/luchillo17/events{/privacy}","received_events_url":"https://api.github.com/users/luchillo17/received_events","type":"User","site_admin":false},"created_at":"2017-05-15T17:49:56Z","updated_at":"2017-05-15T17:49:56Z","body":"Hmm, that's interesting, i've just tested with a new project by adding a lazy module, and it worked as intended, have you changed the project configs? (like using `ng eject` then messing with the webpack.config.js?)"}}
{"actor":{"display_login":"luchillo17"}}