{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular-cli/issues/6417","repository_url":"https://api.github.com/repos/angular/angular-cli","labels_url":"https://api.github.com/repos/angular/angular-cli/issues/6417/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular-cli/issues/6417/comments","events_url":"https://api.github.com/repos/angular/angular-cli/issues/6417/events","html_url":"https://github.com/angular/angular-cli/issues/6417","id":230596565,"number":6417,"title":"Lazy loading module broken with \" No module factory available for dependency type: ContextElementDependency\"","user":{"login":"dherges","id":901354,"avatar_url":"https://avatars1.githubusercontent.com/u/901354?v=4","gravatar_id":"","url":"https://api.github.com/users/dherges","html_url":"https://github.com/dherges","followers_url":"https://api.github.com/users/dherges/followers","following_url":"https://api.github.com/users/dherges/following{/other_user}","gists_url":"https://api.github.com/users/dherges/gists{/gist_id}","starred_url":"https://api.github.com/users/dherges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dherges/subscriptions","organizations_url":"https://api.github.com/users/dherges/orgs","repos_url":"https://api.github.com/users/dherges/repos","events_url":"https://api.github.com/users/dherges/events{/privacy}","received_events_url":"https://api.github.com/users/dherges/received_events","type":"User","site_admin":false},"labels":[{"id":220593713,"url":"https://api.github.com/repos/angular/angular-cli/labels/community:%20help%20wanted","name":"community: help wanted","color":"159818","default":false},{"id":372202272,"url":"https://api.github.com/repos/angular/angular-cli/labels/priority:%202%20(required)","name":"priority: 2 (required)","color":"0052cc","default":false},{"id":531675405,"url":"https://api.github.com/repos/angular/angular-cli/labels/severity3:%20broken","name":"severity3: broken","color":"5319e7","default":false},{"id":385594948,"url":"https://api.github.com/repos/angular/angular-cli/labels/type:%20question/support","name":"type: question/support","color":"EEEEEE","default":false}],"state":"closed","locked":false,"assignee":{"login":"filipesilva","id":4172079,"avatar_url":"https://avatars2.githubusercontent.com/u/4172079?v=4","gravatar_id":"","url":"https://api.github.com/users/filipesilva","html_url":"https://github.com/filipesilva","followers_url":"https://api.github.com/users/filipesilva/followers","following_url":"https://api.github.com/users/filipesilva/following{/other_user}","gists_url":"https://api.github.com/users/filipesilva/gists{/gist_id}","starred_url":"https://api.github.com/users/filipesilva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filipesilva/subscriptions","organizations_url":"https://api.github.com/users/filipesilva/orgs","repos_url":"https://api.github.com/users/filipesilva/repos","events_url":"https://api.github.com/users/filipesilva/events{/privacy}","received_events_url":"https://api.github.com/users/filipesilva/received_events","type":"User","site_admin":false},"assignees":[{"login":"filipesilva","id":4172079,"avatar_url":"https://avatars2.githubusercontent.com/u/4172079?v=4","gravatar_id":"","url":"https://api.github.com/users/filipesilva","html_url":"https://github.com/filipesilva","followers_url":"https://api.github.com/users/filipesilva/followers","following_url":"https://api.github.com/users/filipesilva/following{/other_user}","gists_url":"https://api.github.com/users/filipesilva/gists{/gist_id}","starred_url":"https://api.github.com/users/filipesilva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filipesilva/subscriptions","organizations_url":"https://api.github.com/users/filipesilva/orgs","repos_url":"https://api.github.com/users/filipesilva/repos","events_url":"https://api.github.com/users/filipesilva/events{/privacy}","received_events_url":"https://api.github.com/users/filipesilva/received_events","type":"User","site_admin":false}],"milestone":null,"comments":22,"created_at":"2017-05-23T06:07:48Z","updated_at":"2017-07-23T18:36:11Z","closed_at":"2017-07-17T09:34:43Z","body":"### Bug Report or Feature Request (mark with an `x`)\r\n```\r\n- [x] bug report -> please search issues before submitting\r\n- [ ] feature request\r\n```\r\n\r\n### Versions.\r\n\r\n```\r\n$ ng --version\r\n    _                      _                 ____ _     ___\r\n   / \\   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|\r\n  / △ \\ | '_ \\ / _` | | | | |/ _` | '__|   | |   | |    | |\r\n / ___ \\| | | | (_| | |_| | | (_| | |      | |___| |___ | |\r\n/_/   \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_|       \\____|_____|___|\r\n               |___/\r\n@angular/cli: 1.1.0-rc.0\r\nnode: 6.10.0\r\nos: win32 x64\r\n@angular/common: 4.1.3\r\n@angular/compiler: 4.1.3\r\n@angular/core: 4.1.3\r\n@angular/forms: 4.1.3\r\n@angular/http: 4.1.3\r\n@angular/platform-browser: 4.1.3\r\n@angular/platform-browser-dynamic: 4.1.3\r\n@angular/router: 4.1.3\r\n@angular/cli: 1.1.0-rc.0\r\n@angular/compiler-cli: 4.1.3\r\n@angular/tsc-wrapped: 4.1.3\r\n```\r\n\r\n\r\n### Repro steps.\r\n\r\nInclude a lazy loaded module in `AppRoutingModule`.\r\n\r\nThis doesn't happen with a fresh `ng new <project>` set-up. When adding `\"webpack\": \"^2.5.0\"` dependency, this breaks the build.\r\n\r\n```json\r\n    \"typescript\": \"~2.3.1\",\r\n    \"webpack\": \"^2.5.0\",\r\n    \"webpack-dev-middleware\": \"^1.10.2\",\r\n    \"webpack-dev-server\": \"^2.4.5\",\r\n    \"webpack-md5-hash\": \"^0.0.5\",\r\n    \"webpack-merge\": \"^4.1.0\"\r\n```\r\n\r\nA repro can be found here: [dherges/ng-cli-lazy-loading-broken-6417](https://github.com/dherges/ng-cli-lazy-loading-broken-6417). The [change in package.json dependencies](https://github.com/dherges/ng-cli-lazy-loading-broken-6417/compare/working...broken) breaks the build.\r\n\r\n\r\n\r\n### The log given by the failure.\r\n\r\n```\r\nwebpack: Compiling...\r\n 40% building modules 1/2 modules 1 active ...ework\\guide\\app\\app-routing.module.tsError: No module factory available for dependency type: ContextElementDependency\r\n    at Compilation.addModuleDependencies (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:206:21)\r\n    at Compilation.processModuleDependencies (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:195:8)\r\n    at _this.buildModule.err (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:336:13)\r\n    at building.forEach.cb (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:140:27)\r\n    at Array.forEach (native)\r\n    at callback (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:140:13)\r\n    at module.build (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:167:11)\r\n    at resolveDependencies (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\ContextModule.js:133:4)\r\n    at ContextModule.result.resolveDependencies (<project>\\node_modules\\@ngtools\\webpack\\src\\plugin.js:229:25)\r\n    at ContextModule.build (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\ContextModule.js:103:8)\r\n    at Compilation.buildModule (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:142:10)\r\n    at factoryCallback (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:325:11)\r\n    at <project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\ContextModuleFactory.js:96:12\r\n    at <project>\\node_modules\\tapable\\lib\\Tapable.js:204:11\r\n    at done.then (<project>\\node_modules\\@ngtools\\webpack\\src\\plugin.js:231:28)\r\n    at process._tickCallback (internal/process/next_tick.js:103:7)\r\n 70% building modules 2/2 modules 0 active\r\n```\r\n\r\n\r\n```\r\n 14% building modules 36/48 modules 12 active ...e_modules\\rxjs\\add\\operator\\filter.js<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\li\r\nb\\Compilation.js:265\r\n                                if(_this.profile) {\r\n                                        ^\r\n\r\nTypeError: Cannot read property 'profile' of null\r\n    at factoryCallback (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\Compilation.js:265:13)\r\n    at factory (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\NormalModuleFactory.js:253:5)\r\n    at applyPluginsAsyncWaterfall (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\NormalModuleFactory.js:99:14)\r\n    at <project>\\node_modules\\tapable\\lib\\Tapable.js:204:11\r\n    at NormalModuleFactory.params.normalModuleFactory.plugin (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\CompatibilityPlugin.js\r\n:52:5)\r\n    at NormalModuleFactory.applyPluginsAsyncWaterfall (<project>\\node_modules\\tapable\\lib\\Tapable.js:208:13)\r\n    at resolver (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\NormalModuleFactory.js:74:11)\r\n    at process.nextTick (<project>\\node_modules\\@angular\\cli\\node_modules\\webpack\\lib\\NormalModuleFactory.js:205:8)\r\n    at _combinedTickCallback (internal/process/next_tick.js:67:7)\r\n    at process._tickCallback (internal/process/next_tick.js:98:9)\r\n```\r\n\r\n\r\n\r\n### Desired functionality.\r\n\r\nLazy loading:\r\n\r\n\r\n```ts\r\nconst routes: Routes = [\r\n  {\r\n    path: 'content',\r\n    loadChildren: './+content/content.module#ContentModule'\r\n  }\r\n];\r\n\r\n@NgModule({\r\n  imports: [RouterModule.forRoot(routes)],\r\n  exports: [RouterModule]\r\n})\r\nexport class AppRoutingModule { }\r\n```\r\n\r\n### Mention any other details that might be useful.\r\n\r\nThere are other related issues from the past #3793, #4246 "},"comment":{"url":"https://api.github.com/repos/angular/angular-cli/issues/comments/317272828","html_url":"https://github.com/angular/angular-cli/issues/6417#issuecomment-317272828","issue_url":"https://api.github.com/repos/angular/angular-cli/issues/6417","id":317272828,"user":{"login":"dzolnjan","id":3109244,"avatar_url":"https://avatars0.githubusercontent.com/u/3109244?v=4","gravatar_id":"","url":"https://api.github.com/users/dzolnjan","html_url":"https://github.com/dzolnjan","followers_url":"https://api.github.com/users/dzolnjan/followers","following_url":"https://api.github.com/users/dzolnjan/following{/other_user}","gists_url":"https://api.github.com/users/dzolnjan/gists{/gist_id}","starred_url":"https://api.github.com/users/dzolnjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzolnjan/subscriptions","organizations_url":"https://api.github.com/users/dzolnjan/orgs","repos_url":"https://api.github.com/users/dzolnjan/repos","events_url":"https://api.github.com/users/dzolnjan/events{/privacy}","received_events_url":"https://api.github.com/users/dzolnjan/received_events","type":"User","site_admin":false},"created_at":"2017-07-23T18:36:11Z","updated_at":"2017-07-23T18:36:11Z","body":"I'm getting same error only on Teamcity build. Works fine locally.\r\n\r\nWhen I remove lazy loaded routes then it works on Teamcity also. "}}
{"actor":{"display_login":"dzolnjan"}}