Skip to content

Project references are not picked up (1) #80423

@OliverJAsh

Description

@OliverJAsh
  • VSCode Version: 1.38.0
  • OS Version: 10.14.6
  • TypeScript version: tested with both 3.5.2 and 3.6.2

Steps to Reproduce:

./tsconfig-src.json:

{
    "compilerOptions": {
        "composite": true,
        "declarationMap": true,
        "outDir": "./target/",
        "baseUrl": "./src/"
    },
    "include": ["./src/**/*"]
}

./tsconfig.json:

{
    "references": [{ "path": "./tsconfig-src.json" }],
    "files": []
}

./src/main.ts:

import { foo } from 'helpers/functions';

foo;

./src/helpers/functions.ts:

export const foo = 1;

When I run tsc --build, it builds with no errors.

When I navigate to a TS file in VS Code, e.g. ./src/main.ts, I get errors: Cannot find module 'helpers/functions'

image

I expected this to work because VS Code would find the ./tsconfig.json in the parent/root directory, and this references ./tsconfig-src.json (the TS project which includes the file I'm looking at: ./src/main.ts).

Repo including the above test case: https://github.com/OliverJAsh/unsplash-ts-project-references

I understand I could workaround this by moving ./tsconfig-src.json into the ./src/ folder at ./src/tsconfig.json, but I believe that shouldn't be necessary.

What's more, in my real world application the ./tsconfig-src.json includes files in multiple root folders (./src/, ./client/, ./server/), not just ./src/, so this workaround wouldn't help in that case. For an example, see https://github.com/OliverJAsh/unsplash-ts-project-references/tree/bad-workaround.

Does this issue occur when all extensions are disabled?: Yes

Potentially related:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions