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

ts-node doesn't resolve extended tsconfigs if they originate from the export fields of packages #2112

Open
ItamarGronich opened this issue Mar 18, 2024 · 1 comment

Comments

@ItamarGronich
Copy link

ItamarGronich commented Mar 18, 2024

Search Terms

exports, package.json, tsconfig, extends, base config

Description

While tsc works and resolves the config files from the exports fields of the packages, ts-node fails.

Expected Behavior

ts-node finds and reads extended configs from an external package when they're defined in the packageJson.exports field.

Actual Behavior

ts-node fails to parse the config and exits with an error.

Minimal reproduction

Repro: TypeStrong/ts-node-repros#39

This setup includes two packages @tsnode-exports/main a regular package and a @tsnode-exports/ts-config holding just the base tsconfig file.

in package ts-config the tsconfig file is in some internal folder and is exposed via the package.json field: exports

In package main we have a tsconfig with an extends that points to that tsconfig in the ts-config package.

Steps to reproduce the problem

  1. clone and checkout branch
  2. make sure you got the right node version (v20.11.0)
  3. run npm ci
  4. See how tsc builds successfully by running npm run tsc
  5. See how ts-node fails to build by running npm run ts-node

Specifications

  • ts-node version: v10.9.2
  • node version: v20.11.0
  • TypeScript version: v5.4.2
  • tsconfig.json, if you're using one: (in repro)
  • package.json: in repro
  • Operating system and version: MacOS Sonoma 14.3.1
@porteneuve
Copy link

This is indeed problematic. Any project relying on ts-node, such as Nx, breaks in a pretty opaque way when working in a context where the tsconfig.json extends a config exposed through a dep's exports path, which is what we do at work for our centralized configs package.

Worried that this issue has been unacknowledged for 6+ months

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