Skip to content

VSCode ignore paths defined in tsconfig.json #20285

@mjbvz

Description

@mjbvz

From @atiris on November 22, 2017 15:43

  • VSCode Version: Code 1.17.2 (b813d12980308015bcd2b3a2f6efa5c810c33ba5, 2017-10-16T13:57:00.652Z)
  • OS Version: Linux x64 4.13.11-200.fc26.x86_64
  • Extensions:
Extension Author (truncated) Version
ng-template Ang 0.1.7
vscode-markdownlint Dav 0.11.1
EditorConfig Edi 0.11.1
beautify Hoo 1.1.1
material-icon-theme PKi 3.0.0
vscode-docker Pet 0.0.22
ActiveFileInStatusBar Ros 1.0.3
code-settings-sync Sha 2.8.6
html-snippets abu 0.1.0
path-intellisense chr 1.4.2
githistory don 0.2.3
gitlens eam 5.7.1
tslint eg2 1.0.14
prettier-vscode esb 0.26.0
php-debug fel 1.12.1
php-intellisense fel 2.0.1
code-runner for 0.8.4
vscode-auto-open-markdown-preview hnw 0.0.4
rest-client hum 0.16.1
angular2-switcher inf 0.1.4
docthis joe 0.6.0
angular-essentials joh 0.3.2
Angular2 joh 2.11.2
vscode-codemetrics kis 1.11.1
ecdc mit 0.11.0
azure-account ms- 0.1.3
PowerShell ms- 1.5.1
debugger-for-chrome msj 3.5.0
angular2-inline nat 0.0.17
typescript-hero rbb 1.7.0
vscode-statusbar-json-path ric 1.0.7
autoimport ste 1.5.3
colonize vms 2.2.2
vscode-todo-highlight way 0.5.11
local-history xyz 1.6.1

(1 theme extensions excluded)


Steps to Reproduce:

  1. ng new path
  2. cd path
  3. code . --disable-extensions
  4. ng g m mod
  5. ng g c com
  6. ng g c mod/moa
  7. ng g c mod/mob
  8. edit tsconfig.json, add:
"baseUrl": "src/",
"paths": {
  "@a/*": ["app/*"],
  "@m/*": ["app/mod/*"],
  "@c": ["app/com/"]
}
  1. add index.ts into src/app/com directory with content:
    export * from './com.component';
  2. edit app.module.ts, replace:
    import { ComComponent } from './com/com.component';
    with
    import { ComComponent } from '@c';
  3. build project: ng build - result: everything is ok
    but '@c' is underlined and listed in PROBLEMS tab as:
    [ts] Cannot find module '@c'. (6, 30)
  4. import ModModule, add this into app.module.ts:
    import { ModModule } from '@a/mod/mod.module';
    imports: [ ... ModModule ... ]
  5. ng build is again OK, vscode shows new problem in PROBLEMS tab:
    [ts] Cannot find module '@a/mod/mod.module (7,27)
    first error is gone, '@c' is not underlined anymore.

So, direct paths to exact place (@c),
and also paths to parent directory (@m/*)
are not evaluated correctly from tsconfig.json file.

Reproduces without extensions: Yes

Copied from original issue: microsoft/vscode#38968

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarifiedVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions