3

I can't get typescript paths to work for VS Code in an Angular cli project.

If you look at https://github.com/gatimus/multiple-test/blob/master/src/app1/app/app.module.ts#L3 throws

[ts] Cannot find module 'shared/shared.module',

even though path is set in tsconfig.app.json and settings.json has the line

"typescript.tsdk": "node_modules/typescript/lib/"

Update: It seems the apps run but VS Code can't find the module. I have version 1.16.1 enter image description here

2
  • I did git clone, yarn, ng serve. Have no problems running the app. Try to restart your ng serve. Commented Sep 21, 2017 at 4:12
  • @Kuncevic it seems that app runs but it is vscode that can't find the module, see updated question. Commented Sep 21, 2017 at 15:24

2 Answers 2

2

Renaming tsconfig.app.json to tsconfig.json and updating .angular-cli.json seems to work.

I am curious though, if the tsconfig file wasn't configurable in angular cli, how would you tell VS Code to use tsconfig.app.json?

3
  • it is good that you figure that out, you can now mark that as an answer ;) Commented Sep 22, 2017 at 1:42
  • It won't let me for 5 hours Commented Sep 22, 2017 at 15:02
  • @WilliamLohan Apparently it doesn't work for tests :-(
    – Martin Nuc
    Commented Jan 27, 2018 at 12:32
0

For anyone still struggling with this, I was having this problem in Atom and it was fixed by following the sym link. (cmnd/ctrl click on the module name that throws the error). This seems to suggest that it is an issue with the IDE and not angular.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.