{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/14171","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/14171/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/14171/comments","events_url":"https://api.github.com/repos/angular/angular/issues/14171/events","html_url":"https://github.com/angular/angular/issues/14171","id":203817716,"number":14171,"title":"AOT compilation seems to ignore main file defined in package.json","user":{"login":"pgrm","id":713456,"avatar_url":"https://avatars1.githubusercontent.com/u/713456?v=3","gravatar_id":"","url":"https://api.github.com/users/pgrm","html_url":"https://github.com/pgrm","followers_url":"https://api.github.com/users/pgrm/followers","following_url":"https://api.github.com/users/pgrm/following{/other_user}","gists_url":"https://api.github.com/users/pgrm/gists{/gist_id}","starred_url":"https://api.github.com/users/pgrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgrm/subscriptions","organizations_url":"https://api.github.com/users/pgrm/orgs","repos_url":"https://api.github.com/users/pgrm/repos","events_url":"https://api.github.com/users/pgrm/events{/privacy}","received_events_url":"https://api.github.com/users/pgrm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-28T17:02:51Z","updated_at":"2017-03-03T07:27:56Z","closed_at":null,"body":"**I'm submitting a ...**  (check one with \"x\")\r\n```\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\n\r\nWhen I add a dependency to https://github.com/IdentityModel/oidc-client-js I cannot run AOT compilation anymore. Normal build without AOT still work. \r\n\r\n````\r\nERROR in ./src/$$_gendir/app/app.module.ngfactory.ts\r\nModule not found: Error: Can't resolve 'oidc-client/oidc-client' in '/Users/peter/Sync/GitHub/test-ng2-aot-oidc-client/src/$$_gendir/app'\r\n @ ./src/$$_gendir/app/app.module.ngfactory.ts 55:0-52\r\n @ ./src/main.ts\r\n @ multi main\r\n````\r\n\r\n**Expected behavior**\r\n\r\nI'd like AOT compilation to work as well.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\n\r\nsee the following repository: https://github.com/pgrm/test-ng2-aot-oidc-client\r\n\r\n- clone repository\r\n- make sure you have [angular-cli](https://github.com/angular/angular-cli) installed\r\n- run `npm install`\r\n- run `ng build --prod --aot`\r\n- you should see an error saying something like this: **... Module not found: Error: Can't resolve 'oidc-client/oidc-client' ...**\r\n- copy the `oidc-client.js` file from `node_modules/oidc-client/lib` one directory up to `node_modules/oidc-client` (`cp node_modules/oidc-client/lib/oidc-client.js node_modules/oidc-client/`)\r\n- run again `ng build --prod --aot`\r\n- *now it should work*\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\n\r\nI'm not sure this is an issue with AOT compilation, or the library itself, but the closest I came to the investigation makes me think, that for AOT compilation the information about the main file in package.json is being ignored. (`\"main\": \"lib/oidc-client.min.js\"`)\r\n\r\n**Please tell us about your environment:**\r\n\r\nThis is failing on MacOS Sierra, Windows 10 and Ubuntu 16.04 x64 \r\n\r\n* **Angular version:** 2.4.5\r\n\r\n````\r\n@angular/common: 2.4.5\r\n@angular/compiler: 2.4.5\r\n@angular/core: 2.4.5\r\n@angular/forms: 2.4.5\r\n@angular/http: 2.4.5\r\n@angular/platform-browser: 2.4.5\r\n@angular/platform-browser-dynamic: 2.4.5\r\n@angular/router: 3.4.5\r\n@angular/compiler-cli: 2.4.5\r\n````\r\n \r\n* **Language:** TypeScript 2.0 and TypeScript 2.2\r\n\r\n* **Node (for AoT issues):** `node --version` =   7.3.0 and 6.9.4\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/283885361","html_url":"https://github.com/angular/angular/issues/14171#issuecomment-283885361","issue_url":"https://api.github.com/repos/angular/angular/issues/14171","id":283885361,"user":{"login":"Toxicable","id":13490925,"avatar_url":"https://avatars0.githubusercontent.com/u/13490925?v=3","gravatar_id":"","url":"https://api.github.com/users/Toxicable","html_url":"https://github.com/Toxicable","followers_url":"https://api.github.com/users/Toxicable/followers","following_url":"https://api.github.com/users/Toxicable/following{/other_user}","gists_url":"https://api.github.com/users/Toxicable/gists{/gist_id}","starred_url":"https://api.github.com/users/Toxicable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toxicable/subscriptions","organizations_url":"https://api.github.com/users/Toxicable/orgs","repos_url":"https://api.github.com/users/Toxicable/repos","events_url":"https://api.github.com/users/Toxicable/events{/privacy}","received_events_url":"https://api.github.com/users/Toxicable/received_events","type":"User","site_admin":false},"created_at":"2017-03-03T07:27:56Z","updated_at":"2017-03-03T07:27:56Z","body":"@pgrm Are you still experiencing this issue on the latest version?"}}
{"actor":{"display_login":"Toxicable"}}