-
-
Notifications
You must be signed in to change notification settings - Fork 534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with pnpm due to removal of realpath function #876
Comments
I run into similar issues with @types/express - which reexports @types/express-serve-static-core... |
I can confirm the same issue that @grogi is seeing. A quick fix is to have the package directly depend on |
@abalmos This is resolved on |
@blakeembrey I tried master and now get a new error:
However, that path is in my pnpm workspace and ts-node 8.x handles it correctly. As a side note, |
That’s the reason 9.x hasn’t been released, I haven’t seen any way in the typescript compiler to support project references automatically although there’s some work on it in TS loader. 8.x works (accidentally) on that front because it’s using the language services directly. |
It was a false positive but worked somehow. You could use a hook instead of adding Your
and then do a It's a much nicer approach and doesn't clutter your |
Issue #797 was resolved in commit 9691206 by removing the
realpath
option from thehost
service parameter for the TypeScript language server. However, this breaking change is not compatible with the package manager pnpm, which makes extensive use of symlinks innode_modules
.This is a simple example to reproduce this problem:
Then create a file
index.ts
with the content:The TypeScript compiler will run without any problems, i.e., executing the following command will finish successfully:
However, when running
then this will yield the error message:
Reason
The package
stellar-sdk
has another dependencystellar-base
. The classNetwork
is defined instellar-base
and re-exported bystellar-sdk
. pnpm will structurenode_modules
as follows (arrows indicate symlinks):When running
ts-node
the TypeScript language server is not able to loadstellar-base
as symlinks are not correctly resolved: TypeScript will first resolve the module namestellar-sdk
found inindex.ts
to<project>/node_modules/stellar-sdk/lib/index.d.ts
but then is unable to resolve the real path of this file (see here and here). When reading<project>/node_modules/stellar-sdk/lib/index.d.ts
, it finds a reference tostellar-base
and tries to resolve it but the module resolution algorithm will not be able to find a packagestellar-base
inside anode_modules
folder that is a parent (or grandparent) directory of<project>/node_modules/stellar-sdk/lib/index.d.ts
.Observe that
stellar-base
can be found if<project>/node_modules/stellar-sdk/lib/index.d.ts
is correctly resolved to<project>/node_modules/.registry.npmjs.org/stellar-sdk/2.3.0/node_modules/stellar-sdk/lib
The text was updated successfully, but these errors were encountered: