nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.5k stars 2.34k forks source link

bug(@nx/js): tsconfig extends does not support Node.js style resolution. #28417

Open douglasduteil opened 1 week ago

douglasduteil commented 1 week ago

Current Behavior

Resolving the extends of a tsconfig is path relative only.

Expected Behavior

\following https://www.typescriptlang.org/tsconfig/#extends On can extends from a node module

GitHub Repo

No response

Steps to Reproduce

  1. install @tsconfig/strictest (or another github.com/tsconfig/bases)
  2. extends your tsconfig with it "extends": "@tsconfig/strictest/tsconfig.json",
  3. Run a nx build 💥

Nx Report


 NX   Report complete - copy this into the issue template

Node           : 20.18.0
OS             : linux-x64
Native Target  : x86_64-linux
pnpm           : 9.12.1

nx             : 20.0.0
@nx/js         : 20.0.0
@nx/eslint     : 20.0.0
@nx/workspace  : 20.0.0
@nx/cypress    : 20.0.0
@nx/devkit     : 20.0.0
@nx/next       : 20.0.0
@nx/react      : 20.0.0
@nx/web        : 20.0.0
@nx/webpack    : 20.0.0
typescript     : 5.6.2
---------------------------------------
Registered Plugins:
@nx/next/plugin

Failure Logs


 Error: ENOENT: no such file or directory, stat '/home/x/y/z/packaages/config/typescript/@tsconfig/strictest/tsconfig.json'
          at statSync (node:fs:1666:25)
          at getTsConfigCacheKey [...]

Package Manager Version

No response

Operating System

Additional Information

See https://www.typescriptlang.org/tsconfig/#extends

kylecarhart commented 2 days ago

I am having this issue as well. Any workarounds?

leosvelperez commented 2 days ago

Thanks for reporting this!

@kylecarhart given the current implementation only resolves relative paths, the only workaround would be to set a relative path to the tsconfig file you're extending from.

I'll work on a fix to support this use case.