Why am I getting the wrong way when I automatically import the Typescript class into IntelliJ

If I'm in my IntelliJ and I try to specify a space for automatically importing the Typescript class, I get the full path ( import {Http} from "../../../../node_modules/@angular/http/src/http"; ) when I would expect a shorter inclusion ( import {Http} from "@angular/http" )

This worked at some point, but I cannot figure out which settings are reworked. Anyone have an idea? I am in 2017.

+8
intellij-idea webstorm pycharm typescript
source share
2 answers

You have a node_modules exception in the project settings, only not excluded modules are used for automatic import. Automatic import receives packages from your package.json file. Check out the comments here: https://youtrack.jetbrains.com/issue/WEB-25643#tab=Comments

0
source share

In settings | Editor | Code Style | TypeScript | Import , try enabling Use paths relative to tsconfig.json . When this check box is selected, import paths are calculated relative to the "baseUrl" specified in tsconfig; if this parameter is omitted, it is considered equal to the directory where tsconfig.json is located.

0
source share

All Articles