We have a monorepo using pnpm workspace, and multiple services are using the graphql
package, with different versions.
Trying to compile one service using tsc --explainFiles
, I get this:
../../node_modules/.pnpm/[email protected][email protected]/node_modules/apollo-link/lib/index.d.ts
Imported via 'apollo-link' from file '../../somewhere/in/project.ts' with packageId 'apollo-link/lib/[email protected]'
File redirects to file '../../node_modules/.pnpm/[email protected][email protected]/node_modules/apollo-link/lib/index.d.ts'
And the compilation fails due to type mismatches.
Why is this redirection? I checked, and there is no symlink between these files or directories.
tsc
already resolved the correct dependency, why redirect to another one?
Checked all versions in package.json
, and everything seems to be ok.
When adding to tsconfig.json
:
"paths": {
"*": ["node_modules/*"]
}
It fixes the problem, but I have no idea why this prevents the redirect, and what are other implications this might have.
Thanks for the help!