{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular-cli/issues/3837","repository_url":"https://api.github.com/repos/angular/angular-cli","labels_url":"https://api.github.com/repos/angular/angular-cli/issues/3837/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular-cli/issues/3837/comments","events_url":"https://api.github.com/repos/angular/angular-cli/issues/3837/events","html_url":"https://github.com/angular/angular-cli/issues/3837","id":198512339,"node_id":"MDU6SXNzdWUxOTg1MTIzMzk=","number":3837,"title":"tsconfig \"paths\" config is not recognized","user":{"login":"lehresman","id":96005,"node_id":"MDQ6VXNlcjk2MDA1","avatar_url":"https://avatars2.githubusercontent.com/u/96005?v=4","gravatar_id":"","url":"https://api.github.com/users/lehresman","html_url":"https://github.com/lehresman","followers_url":"https://api.github.com/users/lehresman/followers","following_url":"https://api.github.com/users/lehresman/following{/other_user}","gists_url":"https://api.github.com/users/lehresman/gists{/gist_id}","starred_url":"https://api.github.com/users/lehresman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lehresman/subscriptions","organizations_url":"https://api.github.com/users/lehresman/orgs","repos_url":"https://api.github.com/users/lehresman/repos","events_url":"https://api.github.com/users/lehresman/events{/privacy}","received_events_url":"https://api.github.com/users/lehresman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":32,"created_at":"2017-01-03T16:30:15Z","updated_at":"2018-11-08T14:50:33Z","closed_at":"2017-01-24T12:54:13Z","author_association":"NONE","body":"Mac OSX Sierra\r\nangular-cli version 1.0.0-beta.24\r\n\r\nI'm trying to configure things so I don't have to use ugly (and brittle) relative paths when including modules from my own project.  I modified tsconfig.json to include:\r\n\r\n```{\r\n  \"compilerOptions\": {\r\n    \"baseUrl\": \".\",\r\n    \"paths\": {\r\n      \"@app/*\": \"app/*\"\r\n    },\r\n   ...\r\n```\r\n\r\nAnd that works great for TypeScript.\r\n\r\nHowever, \"ng serve\" is throwing this error:\r\n\r\n```\r\nERROR in ./src/app/content/content.component.ts\r\nModule build failed: Error: /Users/lehresman/Projects/gazelle-ui/src/app/content/content.component.ts (2,29): Cannot find module '@app/models/client.model'.)\r\n    at _checkDiagnostics (/Users/lehresman/Projects/gazelle-ui/node_modules/@ngtools/webpack/src/loader.js:116:15)\r\n    at /Users/lehresman/Projects/gazelle-ui/node_modules/@ngtools/webpack/src/loader.js:141:17\r\n @ ./src/app/app.module.ts 17:0-65\r\n @ ./src/main.ts\r\n @ multi main\r\n```\r\n\r\nI've discovered that Webpack has configuration options for this, but I can't figure out how to configure Webpack through Angular-CLI to support this.  Is this a bug, or is this feature not exposed?"},"comment":{"url":"https://api.github.com/repos/angular/angular-cli/issues/comments/437019551","html_url":"https://github.com/angular/angular-cli/issues/3837#issuecomment-437019551","issue_url":"https://api.github.com/repos/angular/angular-cli/issues/3837","id":437019551,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzAxOTU1MQ==","user":{"login":"seabass223","id":461135,"node_id":"MDQ6VXNlcjQ2MTEzNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/461135?v=4","gravatar_id":"","url":"https://api.github.com/users/seabass223","html_url":"https://github.com/seabass223","followers_url":"https://api.github.com/users/seabass223/followers","following_url":"https://api.github.com/users/seabass223/following{/other_user}","gists_url":"https://api.github.com/users/seabass223/gists{/gist_id}","starred_url":"https://api.github.com/users/seabass223/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seabass223/subscriptions","organizations_url":"https://api.github.com/users/seabass223/orgs","repos_url":"https://api.github.com/users/seabass223/repos","events_url":"https://api.github.com/users/seabass223/events{/privacy}","received_events_url":"https://api.github.com/users/seabass223/received_events","type":"User","site_admin":false},"created_at":"2018-11-08T14:50:33Z","updated_at":"2018-11-08T14:50:33Z","author_association":"NONE","body":"I think I've got it fixed now\r\n\r\nSetup\r\n=======\r\n\r\n- _ng new path-alias-test_\r\n- _cd path-alias-test_\r\n- _npm i -g npm-check-updates && ncu -a && npm i_ (upgrades all packages to latest)\r\n- _ng g s services/a_\r\n- _ng g s services/b_\r\n- _ng g s services/sub/c_\r\n- in **tsconfig.json compilerOptions** node\r\n```\r\n\"baseUrl\": \"src\",\r\n\"paths\":{\r\n   \"@services/*\":[\"app/services/*\"]\r\n},\r\n```\r\n- in **app.component.ts**\r\n```\r\nimport { AService } from '@services/a.service';\r\nimport { BService } from '@services/b.service';\r\nimport { CService } from '@services/sub/c.service';\r\n...\r\nexport class AppComponent {\r\n  title = 'app';\r\n  a: AService;\r\n  b: BService;\r\n  c: CService;\r\n}\r\n\r\n```\r\n- ng serve\r\n\r\nThe above compiles fine with no errors.\r\n\r\n\r\nWhen we add barrel files in order to simplify our imports\r\n---\r\n**src/app/service/index.ts**\r\n```\r\nexport * from './sub';\r\nexport * from './a.service';\r\nexport * from './b.service';\r\n```\r\n**src/app/service/sub/index.ts**\r\n```\r\nexport * from './c.service';\r\n```\r\n\r\nand change **app.component.ts** imports to\r\n```\r\nimport { AService, BService } from '@services/';\r\nimport { CService } from '@services/sub';\r\n```\r\n- ng serve\r\ngives us **ERROR in src/app/app.component.ts(2,36): error TS2307: Cannot find module '@services/'.**\r\nWhy are we getting this error now?\r\n\r\nResolution\r\n---\r\nIf we remove the final * in **tsconfig.json** paths\r\n```\r\n\"paths\":{\r\n   \"@services/*\":[\"app/services/\"]\r\n},\r\n```\r\n- ng serve \r\nnow compiles fine with no errors. I'm not sure why we had to change `[\"app/services/*\"]` to `[\"app/services/\"]` for concise imports to work with barrel(index.ts) files. "}}
{"actor":{"display_login":"seabass223"}}