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

Not able to extend config from packages having subpath exports map #2146

Open
kwonoj opened this issue Jan 2, 2025 · 0 comments · May be fixed by #2147
Open

Not able to extend config from packages having subpath exports map #2146

kwonoj opened this issue Jan 2, 2025 · 0 comments · May be fixed by #2147

Comments

@kwonoj
Copy link

kwonoj commented Jan 2, 2025

Search Terms

tsconfig, extends, workspaces, exports, subpath

Expected Behavior

ts-node should able to resolve if extends: points to the workspace package have subpath exports map.

// Some package uses config
{
  "extends": "@test/tsconfig/tsconfig.json",
}
//@test/tsconfig/package.json

{
  "name": "@test/tsconfig",
  "version": "0.0.0",
  "license": "UNLICENSED",
  "private": true,
  "exports": {
    ".": "./tsconfig.base.json",
    "./tsconfig.json": "./tsconfig.base.json",
    "./tsconfig.cjs.json": "./tsconfig.cjs.json"
  }
}

Actual Behavior

Not able to resolve modules.

Steps to reproduce the problem

https://github.com/kwonoj/wallaby-workspace-test

yarn

// check plain ts-node behavior
npx ts-node ./packages/pkg-core/src/index.ts

// jest with ts-node
yarn workspace @test/core run test-jest

Minimal reproduction

See above

Description

Related with #2091. In the PR, It sets conditions to undefined (https://github.com/TypeStrong/ts-node/pull/2091/files#diff-47fe05042c9c335713e6ad6b3933e31a4b4f870f0892d2614d28312b36e4b239R51) - which makes ts to set noderesolution feature to None (https://github.com/microsoft/TypeScript/blob/d701d908d534e68cfab24b6df15539014ac348a3/src/compiler/moduleNameResolver.ts#L1787).

This effectively disables all of node.js package.json's subpath exports (https://github.com/microsoft/TypeScript/blob/v5.7.2/src/compiler/moduleNameResolver.ts#L1685-L1689) either local (#imports) or exports. So if any package have exports / imports subpath map / alias, tsconfig extending it will fail to resolve module.

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

Successfully merging a pull request may close this issue.

1 participant