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

File undefined not found error when loading tsconfig extends file [Yarn 2] #182

Open
basal-luke opened this issue Jul 4, 2023 · 2 comments

Comments

@basal-luke
Copy link

tsc-alias throws a File undefined not found exception when extending a tsconfig which has been installed via Yarn 2

Expected Behavior
tsc-alias builds successfully when my tsconfig extends another tsconfig

Current Behavior
tsc-alias throws a file not found error when when my tsconfig extends another tsconfig installed which is installed via Yarn 2 (plug n play)

Steps to reproduce

  1. Install a tsconfig package via Yarn 2 e.g https://www.npmjs.com/package/@tsconfig/recommended
  2. Extend this package in the project tsconfig "extends": "@tsconfig/recommended/tsconfig.json"
  3. Run tsc-alias

Example Repo
https://github.com/basal-luke/tsc-alias-yarn-issue

@basal-luke
Copy link
Author

Related: #176

@bskinner
Copy link

bskinner commented Feb 29, 2024

I ran into this same issue and did some digging into tsc-alias. From my understanding, it appears the resolveTsConfigExtendsPath in src/helpers/config.ts expects a node_modules folder to exist somewhere in the directory hierarchy when resolving the extends field (via the mylas package). When using Yarn versions >= 2, Yarn uses it's PnP API by default for resolving modules, and does not create a node_modules directory. I have not verified that this is the only location which may need changes.

Changing the value of the nodeLinker key to node-modules in my .yarnrc.yml and rerunning yarn to reinstall the dependencies fixed the issue (but does reintroduce the node_modules folder, which may be undesirable in some setups).

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

2 participants