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

fix(js): use workspace rootDir while compiling TS files #19726

Closed
wants to merge 1 commit into from

Conversation

kopach
Copy link
Contributor

@kopach kopach commented Oct 19, 2023

Fixes #11583

Tested this approach for some time already on real project using pnpm's patch mechanism

@kopach kopach requested a review from a team as a code owner October 19, 2023 06:53
@kopach kopach requested a review from FrozenPandaz October 19, 2023 06:53
@vercel
Copy link

vercel bot commented Oct 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Oct 20, 2023 3:31pm

tsConfig.options.rootDir = options.rootDir;
tsConfig.options.rootDir = '.';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix is based on conversation from here: #11583
The only problem is that options.root (as suggested in comments) are always undefined. Tested and

tsConfig.options.rootDir = undefined;

Works as well. Decided to use '.' instead of undefined as similar approach is used in several other places in codebase

@kopach
Copy link
Contributor Author

kopach commented Oct 20, 2023

hi @FrozenPandaz, could you, please, advice how can I handle the CI failing issue? I'ts not clear for me what exactly failing and why

@mandarini mandarini assigned mandarini and unassigned mandarini Oct 24, 2023
@mandarini
Copy link
Member

@leosvelperez I am asking for your review, because I think you were the one working on the "file is not under rootDir" issues.

@leosvelperez
Copy link
Member

hey @kopach! Thanks for taking the time to contribute, and apologies for the delay in reviewing it.

I'm going to close this since the current implementation is working as expected. All projects are built with the rootDir set to the project root or to what the user provides in the @nx/js:tsc executor options. The linked issue occurs due to a manual misconfiguration. I closed that issue by explaining this and how to solve it: #11583 (comment).

Other issues could result in the same error, but they are also solved differently and without the need to change the implementation.

Copy link

github-actions bot commented Feb 5, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
@kopach kopach deleted the js branch March 8, 2024 20:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

library importing other library using wildcard path mapping fails with "is not under 'rootDir'"
3 participants