Skip to content
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

support for project references? #239

Open
JasonKleban opened this issue Dec 24, 2020 · 10 comments
Open

support for project references? #239

JasonKleban opened this issue Dec 24, 2020 · 10 comments

Comments

@JasonKleban
Copy link

Issue description

On the latest ts-node-dev, it seems to behave akin to tsc --watch -p . because I get errors about project reference imported modules not being found. Is there a way to have it operate akin to tsc --build --watch instead so that project references are supported? I don't see any mention of it in the docs or issues. Thanks!

Context

OS version (is it docker or host?), ts-node-dev version

Windows 10, tsnd 1.1.1

@wclr
Copy link
Owner

wclr commented Dec 24, 2020

Did you try to run with --files flag?

@JasonKleban
Copy link
Author

https://github.com/TypeStrong/ts-node#help-my-types-are-missing

TypeScript Node does not use files, include or exclude, by default. ... If you must use files, include, or exclude, enable --files flags

So I tried tsnd --files -- ./src but it doesn't seem to make any difference. My .tsconfigs don't use files: [] at all anyway.

ts-node's support for --build is unclear to me. I found these old issues, but it feels like they might just be stale at this point:

I'm gathering that there's an important difference - incremental api even applicable within a single project, whereas --build adds to that the following of project references.

@wclr
Copy link
Owner

wclr commented Dec 24, 2020

Does running with ts-node work?

@JasonKleban
Copy link
Author

I don't think so. I guess I'm just looking for clarification on what can be expected to work these days. Perhaps there's a flag that you or others are yourselves using successfully that I'm missing. Or you perhaps have a nuanced understanding of why this can't work, or an outline of particularly what change in ts-node or tsc's api would have to happen before this usecase can be supported.

@wclr
Copy link
Owner

wclr commented Dec 29, 2020

because I get errors about project reference

I even didn't see how your errors look like.

@JasonKleban
Copy link
Author

The errors are the same as when I (incorrectly) try tsc --project . instead of tsc --build. It complains of not being able to find modules that are project references.

error TS2307: Cannot find module 'host-common' or its corresponding type declarations.

1 import { foo as fooCommon } from "host-common";

@wclr
Copy link
Owner

wclr commented Dec 29, 2020

I'm not sure why tsc can not see this package types

@JasonKleban
Copy link
Author

Do you mean that you expect this to work, and that it might just be something configured incorrectly with my project? Or are you saying that you don't know why tsc requires --build mode to understand project references? (I don't know that either, but I've seen hints in documentation that it is for backward compatibility with older typescript projects)

@wclr
Copy link
Owner

wclr commented Dec 29, 2020

There is something with your project configuration I believe. You may try to make a simple repro example.

@Aveyder
Copy link

Aveyder commented Jul 31, 2021

For those facing the same problem, this is primarily related to ts-node see TypeStrong/ts-node#897 (looks like it doesn't support tsc -b flag at the moment). In the mentioned issue some workarounds can be found:

  1. Using concurrently with tsc -b -w & nodemon
    ts-node with project references in a lerna monorepo TypeStrong/ts-node#897 (comment)
  2. Using tsc-watch & node
    ts-node with project references in a lerna monorepo TypeStrong/ts-node#897 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants