{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/13590","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/13590/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/13590/comments","events_url":"https://api.github.com/repos/angular/angular/issues/13590/events","html_url":"https://github.com/angular/angular/issues/13590","id":196713632,"number":13590,"title":"Angular2 AOT compilation - \"Cannot determine the module for class (... many components which are unused)\"","user":{"login":"swimmadude66","id":2327198,"avatar_url":"https://avatars.githubusercontent.com/u/2327198?v=3","gravatar_id":"","url":"https://api.github.com/users/swimmadude66","html_url":"https://github.com/swimmadude66","followers_url":"https://api.github.com/users/swimmadude66/followers","following_url":"https://api.github.com/users/swimmadude66/following{/other_user}","gists_url":"https://api.github.com/users/swimmadude66/gists{/gist_id}","starred_url":"https://api.github.com/users/swimmadude66/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swimmadude66/subscriptions","organizations_url":"https://api.github.com/users/swimmadude66/orgs","repos_url":"https://api.github.com/users/swimmadude66/repos","events_url":"https://api.github.com/users/swimmadude66/events{/privacy}","received_events_url":"https://api.github.com/users/swimmadude66/received_events","type":"User","site_admin":false},"labels":[{"id":375501288,"url":"https://api.github.com/repos/angular/angular/labels/comp:%20core%20&%20compiler","name":"comp: core & compiler","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-12-20T16:14:49Z","updated_at":"2016-12-27T22:38:10Z","closed_at":null,"body":"```\r\n[ x ] bug report => search github for a similar issue or PR before submitting\r\n[ ] feature request\r\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n**Current behavior**\r\nUnused components/pipes/directives in my workspace are detected by the compiler, which throws the error `Cannot determine the module for class (...)` for each file. It stops compilation, and does not seem be configurable. This is a problem, since I need to have those files in my workspace, but do not need them in the resultant app (partner implementations requiring different combos of shared components). This is especially frustrating with regards to compiling in a webpack loader, which should be able to provide a list of files which are included, regardless of workspace.\r\n\r\n**Expected behavior**\r\nI would expect these errors to be warnings, and/or able to be silenced by a compiler option. Alternatively, with regards to webpack, you could allow a list of files to be inserted, so that a webpack could provide all files in the require chain, instead of all files in the workspace.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\nCannot demo in plunkr, since it uses JIT. \r\n\r\n1. Create a basic angular app which bootstraps an ngModule with one component, AppComponent\r\n2. Get this app into a state which can be AOT compiled (should be pretty easy with a hello world)\r\n3. Add a component to the directory structure, but do not reference it anywhere in your code.\r\n4. Try to AOT compile again. You will get the warning `Cannot determine the module for class`\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nMy company has a base app for ourselves, and our partners use modified versions of that app as their own. Rather than maintain all partners separately, we use a shared library of common generic components, imported as needed. For our base app, everything is fine, since we use every component. For partners, we cannot use AOT, since some of the components in the shared npm package do not have a declared module.\r\n\r\n**Please tell us about your environment:**\r\nHappens across all devices, but the current testing setup is:\r\nWIndows 10\r\nVS Code\r\nCmder (bash terminal)\r\n\r\n* **Angular version:**\r\nv2.1.0 (though we have also tested in 2.3.1\r\n\r\n* **Browser:** All - this is a compiler issue, not browser specific\r\n \r\n* **Language:** Typescript\r\n* **Node (for AoT issues):** node v6.3.0\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/269392790","html_url":"https://github.com/angular/angular/issues/13590#issuecomment-269392790","issue_url":"https://api.github.com/repos/angular/angular/issues/13590","id":269392790,"user":{"login":"tbosch","id":690815,"avatar_url":"https://avatars.githubusercontent.com/u/690815?v=3","gravatar_id":"","url":"https://api.github.com/users/tbosch","html_url":"https://github.com/tbosch","followers_url":"https://api.github.com/users/tbosch/followers","following_url":"https://api.github.com/users/tbosch/following{/other_user}","gists_url":"https://api.github.com/users/tbosch/gists{/gist_id}","starred_url":"https://api.github.com/users/tbosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbosch/subscriptions","organizations_url":"https://api.github.com/users/tbosch/orgs","repos_url":"https://api.github.com/users/tbosch/repos","events_url":"https://api.github.com/users/tbosch/events{/privacy}","received_events_url":"https://api.github.com/users/tbosch/received_events","type":"User","site_admin":false},"created_at":"2016-12-27T22:38:10Z","updated_at":"2016-12-27T22:38:10Z","body":"The general rule is: ngc will compile everything that tsc compiles. And it will try to compile every component that it finds. However, Angular can't compile components without a related module.\r\n\r\nWe could change this error into a warning though."}}
{"actor":{"display_login":"tbosch"}}