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

ESBuild cannot resolve tsconfig extends that use node16 "exports" #3437

Closed
rossipedia opened this issue Oct 9, 2023 · 2 comments
Closed
Labels

Comments

@rossipedia
Copy link

Imagine you have a shared set of Typescript configurations that you use for different project types, laid out something like:

.
├── configs
│   ├── tsconfig.environment-agnostic.json
│   ├── tsconfig.node-cjs.json
│   ├── tsconfig.node-esm.json
│   ├── tsconfig.react-published.json
│   └── tsconfig.react.json
├── internal
│   └── tsconfig.base.json
└── package.json

And in that package.json you're utilizing explicit package entry points to make those available using a friendlier name:

  "name": "@scope/tsconfigs",
  "exports": {
    "./package.json": "./package.json",
    "./*": "./configs/tsconfig.*.json"
  },

This allows you to write a tsconfig.json like so:

{
  "extends": "@scope/tsconfigs/react",
  "compilerOptions": {
    ...
  }
}

With the intention of extending the config defined in configs/tsconfig.react.json in the tsconfigs package.

Typescript itself will correctly resolve the config file in extends, whereas esbuild issues the following warning:

▲ [WARNING] Cannot find base config file "@scope/tsconfigs/react" [tsconfig.json]

    tsconfig.json:2:13:
Repository owner deleted a comment from mebest100 Oct 11, 2023
@evanw
Copy link
Owner

evanw commented Oct 11, 2023

Sorry about that random comment (which was deleted). Anyone can post anything on GitHub.

Anyway, thanks for the report. I took a look and I was not able to reproduce this given the information you provided. Here's what I tried which seems to work fine. What additional information is necessary to reproduce your problem?

Note that an issue like this has already been fixed last April, in esbuild version 0.17.17: #3058. You will see this behavior if you're using an old version of esbuild. In that case you should update esbuild to get the fix.

@evanw evanw added the tsconfig label Oct 11, 2023
@evanw
Copy link
Owner

evanw commented Oct 17, 2023

I'm closing this issue due to lack of a follow-up reply. We can reopen it in the future if more information is provided.

@evanw evanw closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants