-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
ts-node seems to fail to resolve dependencies in referenced projects #1381
Comments
The https://typestrong.org/ts-node/docs/options |
You can also try adding a triple-slash reference directive in the files that rely on cheerio types. Typically TS knows to look at types because you |
I apologise, that was a mistake in my reproduction script- the error persists with I've also tried the Additionally, I thought I'd add (just to rule out that it's a problem with mocha) that the reproduction command uses mocha but you can get the same error by just running ts-node directly (this is with the explicit import and --files specified):
Also thank you for the quick responses, I really appreciate it! |
I believe this is the same issue as #1421, which is due to how TypeScript is unfortunately repeated invoked on files. It doesn't release this is outside the scope of your type checking project and is trying to also type check it. @cspotcode I think one option might be to default |
Are we sure that https://unpkg.com/browse/[email protected]/package.json#L28 Perhaps it would be helpful to locate where the type |
I've run into the same issue. My project successfully compiles using
I'm using:
|
Hmm, my issue seems to also be related to #897, as I'm working in a monorepo (not lerna, just a yarn PnP monorepo) and the module not being found is being referenced as So on second-thought, maybe these two issues are actually related—and it all comes down to ts-node's support for TS project references? One way that I had this working in the past is by updating the And now that I think through everything, this makes sense why that change worked. ts-node isn't building the referenced projects, but when the package.json's |
See also: #1111 adds the necessary changes for ts-node to understand project references. It also explains what is happening behind the scenes, with TS's internal, monkey-patching of the Host. This monkey-patching teaches the language service that If anyone is motivated to finish that pull request, I will be happy to offer guidance, explain what's going on, and list what's missing. |
@fourpastmidnight you understand the core issue pretty well. As you said, there are 2 possibilities when it is precompiled
it is not precompiled
|
I'm fairly new to all of this, having been thrown into a last-minute project that was a perfect use-case for React. I've learned a lot in the last 3 months, but still not 100% on this ecosystem 😉 I had a look at #1111, but I'm unable to quickly make heads or tails of it. Glad to see, however, that I do understand the core issue even if I'm not quite sure (yet) what it would take to bring #1111 to completion. |
I wound up here again, reading my 14-day old self and your replies because I was once again trying to get ts-node to work with my (the same) project.... LOL. Anyway, it would be super sweet to have #1111 done and implemented. So I guess I should now try to see if I can't figure out what the heck that's all doing! LOL. No promises, I'm busy, but I'd really like to have a quick "F5" experience. |
@fourpastmidnight yeah, it's like everything in open-source. Someone's got to do it, but the benefits are huge once it gets done. If/when you start working on this, please do not hesitate to create draft pull requests, ask questions, create issues, whatever you need to feel productive. The PR and issue trackers exist to "get things done" and I'm a big proponent of pushing WIP, chatting, whatever fits your workflow. |
I landed here after trying to setup an experimental project with yarn workspaces, typescript project references, snowpack for the client side and I give snowpack the Now for @cspotcode Is this a correct understanding of the situation? I think it would be great if the logic to do the re-mapping of If I can help with this I will try subject to time constraints (still haven't got those 36h days I wished for Christmas for the last 20 years :-)). EDIT: Here is an example repo for what i described above, and this note is about the limitation of module resolution. |
+1 this does not work in NX workspaces when I tried to run a node CLI tool that is using some other packages withing the monorepo which are configured via tsconfig paths property in NX. |
|
Expected Behavior
I would expect code that doesn't error when trying to compile it with
tsc
to compile when run throughts-node
.Actual Behavior
I get a TSError warning me about missing dependencies (the README linked below) when ts-node tries to load a referenced project.
Reproduction
I've created a minimal reproduction repo for my scenario here with the behaviour/stack trace and command to reproduce.
Specifications
please see the reproduction repo for the tsconfig structure, here is the effective tsconfig:
Windows 10 Pro 19043.1052
The text was updated successfully, but these errors were encountered: