I have an internal package in my Turborepo setup. Here’s the package.json
:
{
"name": "@repo/shared-types",
"version": "1.0.0",
"main": "./index.js",
"types": "./index.ts",
"dependencies": {
"typescript": "latest"
}
}
I’ve added this package to the dependencies in my app's
package.json
:
"dependencies": {
"@repo/shared-types": "*",
...
}
However, when I try to use things from this internal package, IntelliJ IDEA (2024.1.4) does not recognize it:
If I press Alt + Enter
it does recognize the package, but it shows it only "below the line", therefore not resolving automatically:
What have I tried so far:
File -> Invalidate caches
Settings -> Editor -> General -> Auto Import -> Add unambiguous imports on the fly
."main": "index.js"
to the package.json
in my internal packageAny ideas?
Finally, after a few hours, I was able to solve it.
If you add an empty tsconfig.json
file (!!) in the root folder of the internal package, IntelliJ solves it automatically magically...
I don't know if it's a bug in IntelliJ IDEA or has to do with Turborepo, but that sucks :(
I hope it helps someone in the future.