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

Compiler paths defined in a tsconfig file that tsconfig.base.json extends from are not recognised during project graph creation #29420

Open
1 of 4 tasks
rene-leanix opened this issue Dec 19, 2024 · 1 comment

Comments

@rene-leanix
Copy link

Current Behavior

If compiler paths are not defined in tsconfig.base.json, but in a separate tsconfig-file, which the former extends, any imports using those path aliases are ignored during the creation of the project graph.

Expected Behavior

The resulting/complete tsconfig.base.json is used for the project graph creation.

GitHub Repo

https://github.com/rene-leanix/nx-20.2.2-compiler-paths

Steps to Reproduce

  1. Executing nx graph --file stdout in the example repo does not show that lib1 depends on lib2.

Nx Report

Node           : 18.19.1
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.2.4

nx                     : 20.2.2
@nx/js                 : 20.2.2
@nx/jest               : 20.2.2
@nx/eslint             : 20.2.2
@nx/workspace          : 20.2.2
@nx/angular            : 20.2.2
@nx/devkit             : 20.2.2
@nx/module-federation  : 20.2.2
@nx/plugin             : 20.2.2
@nx/web                : 20.2.2
@nx/webpack            : 20.2.2
typescript             : 5.6.3

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

We have two reasons for wanting to move the paths into a separate file:

  • we have over 200 paths, which make the tsconfig.base.json less readable
  • we also moved the paths for our tsconfig.prod.json-files out into the same folder for re-use and for simplifying keeping them in sync

Using nx generate to create a new lib adds the path to tsconfig.base.json, which then needs to be moved manually. It would be nice to consider any extends and add the paths to the first extended config that includes a path object already, but that's not essential.

@mc-julian
Copy link

mc-julian commented Dec 20, 2024

For me it worked to add both:

"extends": "../../tsconfig.base.json",

"references": [ { "path": "../../tsconfig.base.json" } ],
inside the tsconfig.json.

Can someone answer if this is an official workaround?

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

No branches or pull requests

2 participants