I am working on a project that is linked to some other local project like this:
{
"name": "lib-a",
dependencies: {
"lib-b": "file:../../lib-b"
}
}
The issue is that lib-b has some uncompiled module in its node_modules, and when I run tsc (from within lib-a) I get errors like this:
../node_modules/someLib/src/render.tsx:1:19 - error TS2307: Cannot find module 'react' or its corresponding type declarations.
1 import React from 'react';
I do have the types for react in lib-a's node_modules, but the issue is that lib-b has its own node_modules (outside of lib-a's tree) and typescript tries to search for react there. Is there any way to tell typescript to search for the types in the root's node_modules as well??
here is the project hierarchy:
gitProjects
|_ lib-a <-- running tsc from here
| |_ node_modules
| |_ react
| |_ lib-b (symlink)
|_ lib-b
|_ node_modules
|_ some-uncompiled-lib (that tries to use react)
Note that I am not using a mono-repo (I can't use a monorepo). I am running tsc from within lib-a. when installing lib-b properly (using the published version), everything works. Only when I am using local dependency things starts to fail.
Is there any way around it?