Typescript: Support for workspace workspaces (IntelliJ, VSCode ...)

Working on a large typescript project, we decided to move the code to monorepo with workspaces .

We use webpack to build and build, and everything works well (especially binding between local modules / packages).

Since the workspaces of the yarn will store most of the node_modules in the root folder of mono repo, IDEs (IntelliJ, as well as VSCode) have problems importing into any node_modules when encoding inside an "internal" project (the so-called "package" monorepo).

The strange thing is that the import is unknown, but on the other hand, most of the time you can go to the correct source / definition inside the IDE for the same import if you write it manually.

We tried to tell IntelliJ to look into another folder for node_modules, but still not satisfied.

Please share your experience with the yarn / monorepo workspaces (e.g. lerna) and how you develop code living in these monorepos.

What IDE are you using?

Have you added any special configurations to the IDE and / or package.json, tsconfig.json?

+5
source share
2 answers

IDEA does not provide support for yarn work areas; if you miss this, please follow the WEB-29250 and related upgrade tickets. You can try adding path mappings to your tsconfig.json - see https://intellij-support.jetbrains.com/hc/en-us/community/posts/207656825/comments/115000529564

+3
source

Share your experiences with yarn / monorepo workspaces (like lerna) and how you develop code living in these monorepos.

What IDE are you using?

Since you are asking. I basically ran into the same problems as you. One of the solutions I was considering was to disable node module elevation, as described here . Unfortunately, it looks like it is not yet in a stable release.

What I ended up with was ditiching workspaces so far until they fix either the IDE or the nohoist release. Instead, I use lerna . This is less convenient, but it does not get up so that both build tools and the IDE run.

Oh, I also use IntelliJ (final)

+1
source

Source: https://habr.com/ru/post/1273446/


All Articles