I have a very simple TypeScript monorepo with the following structure:
project/
└── packages/
|── client/
├── server/
| └── src/
| └── main.ts
└── common/
└── src/
└── main.ts
The server has a package.json file with:
"dependencies": {
"common": "file:../common"
},
And the code looks like this:
// in file: common/src/main.ts
export class Foo() {}
// in file: server/src/main.ts
const foo = new Foo();
When I open VSCode, put the cursor over Foo, and do Ctrl+Space, it doesn't find any imports. But if I manually add import { Foo } from "common" to the top of the file, it compiles and works just fine. Why doesn't auto-import work? How can I make it work?
For reference, the above reprex is available to download in a repo located here: https://github.com/Zamiell/test-monorepo