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

Regression in 5.3 tsconfig cannot extend node module #56492

Closed
jd-carroll opened this issue Nov 21, 2023 · 10 comments
Closed

Regression in 5.3 tsconfig cannot extend node module #56492

jd-carroll opened this issue Nov 21, 2023 · 10 comments
Labels
External Relates to another program, environment, or user action which we cannot control.

Comments

@jd-carroll
Copy link

πŸ”Ž Search Terms

tsconfig module extends

πŸ•— Version & Regression Information

Version with issue: v5.3.2

Downgraded to v5.2.2 and issue is resolved

⏯ Playground Link

No response

πŸ’» Code

Monorepo with tsconfig.json in each project that looks like:

{
  "extends": "@project/tsconfig/nextjs.json",
  "compilerOptions": {
     ...
  }
}

Structure of @project/tsconfig

packages
  |- tsconfig
      |- package.json
      |- tsconfig.json  

πŸ™ Actual behavior

Fails to run the script

monorepo % lerna run dev --scope @client-sites/main
info cli using local version of lerna
lerna notice cli v7.4.2
lerna notice filter including "@client-sites/main"
lerna info filter [ '@client-sites/main' ]
lerna info Executing command in 1 package: "yarn run dev"
@client-sites/main: /path/to/monorepo/node_modules/ts-node/src/index.ts:859
@client-sites/main:     return new TSError(diagnosticText, diagnosticCodes, diagnostics);
@client-sites/main:            ^
@client-sites/main: TSError: β¨― Unable to compile TypeScript:
@client-sites/main: error TS6053: File '@project/tsconfig/nextjs.json' not found.
@client-sites/main:     at createTSError (/path/to/monorepo/node_modules/ts-node/src/index.ts:859:12)
@client-sites/main:     at reportTSError (/path/to/monorepo/node_modules/ts-node/src/index.ts:863:19)
@client-sites/main:     at createFromPreloadedConfig (/path/to/monorepo/node_modules/ts-node/src/index.ts:874:36)
@client-sites/main:     at create (/path/to/monorepo/node_modules/ts-node/src/index.ts:624:10)
@client-sites/main:     at Object.register (/path/to/monorepo/node_modules/ts-node/src/index.ts:591:15)
@client-sites/main:     at Object.<anonymous> (/path/to/monorepo/node_modules/ts-node/register/index.js:1:16)
@client-sites/main:     at Module._compile (node:internal/modules/cjs/loader:1241:14)
@client-sites/main:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
@client-sites/main:     at Module.load (node:internal/modules/cjs/loader:1091:32)
@client-sites/main:     at Function.Module._load (node:internal/modules/cjs/loader:938:12) {
@client-sites/main:   diagnosticCodes: [ 6053 ]
@client-sites/main: }

πŸ™‚ Expected behavior

For the script to actually run the dev server

monorepo % lerna run dev --scope @client-sites/main
info cli using local version of lerna
lerna notice cli v7.4.2
lerna notice filter including "@client-sites/main"
lerna info filter [ '@client-sites/main' ]
lerna info Executing command in 1 package: "yarn run dev"
@client-sites/main: Successfully wrote configuration: ...
...

Additional information about the issue

No response

@jakebailey
Copy link
Member

If you're able to control your TypeScript version, can you bisect using https://www.npmjs.com/package/every-ts ? You haven't provided a project to test on so we can't really do anything.

@jakebailey
Copy link
Member

Also, this error is given by ts-node; can you reproduce it with just tsc?

@VirtualWolf
Copy link

I've added a really simple repo here that demonstrates the issue.

tsc doesn't have any problems at any point, it's only running via ts-node that doesn't work. Downgrading to Typescript 5.2.2 or updating the ts-config.json extends option to include ./node_modules both work to fix it.

@tanimaroy2012
Copy link

im seeing the same issue so far @VirtualWolf solution is working for me

@effektsvk
Copy link

Hello, I was debugging this issue and I found out that there is a breaking change in nodeModuleNameResolver function. ts-node uses this function and passes the isConfigLookup boolean into 7th argument, which was moved due to the new conditions argument.

export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, conditions?: string[], isConfigLookup?: boolean): ResolvedModuleWithFailedLookupLocations {

Here it is used in ts-node.
https://github.com/TypeStrong/ts-node/blob/c06cbe7d83b5585bb24f9963c42ce13eadd2202f/src/ts-internals.ts#L43-L51

@andrewbranch andrewbranch added the External Relates to another program, environment, or user action which we cannot control. label Nov 22, 2023
@andrewbranch
Copy link
Member

For the record that overload is @internal. The public API didn’t change but I guess ts-node needed to access the internal one. They’ll need to make an update on their end. Thanks @effektsvk!

@typescript-bot
Copy link
Collaborator

This issue has been marked as "External" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2023
NathanVss added a commit to openfun/cunningham that referenced this issue Nov 27, 2023
This new Typescript version introduced a crash when executing ts-node
in order to run cunningham.ts file. We need to wait for ts-node
to update their package too. Please see the related issue:
microsoft/TypeScript#56492
NathanVss added a commit to openfun/cunningham that referenced this issue Nov 27, 2023
This new Typescript version introduced a crash when executing ts-node
in order to run cunningham.ts file. We need to wait for ts-node
to update their package too. Please see the related issue:
microsoft/TypeScript#56492
NathanVss added a commit to openfun/cunningham that referenced this issue Nov 27, 2023
This new Typescript version introduced a crash when executing ts-node
in order to run cunningham.ts file. We need to wait for ts-node
to update their package too. Please see the related issue:
microsoft/TypeScript#56492
@matsko
Copy link

matsko commented Nov 29, 2023

Just use tsx instead of ts-node

@cd-ff
Copy link

cd-ff commented Dec 4, 2023

ts-node issue: TypeStrong/ts-node#2076

@SStranks
Copy link

It doesn't work for me on either ts-node or tsx, on TS 5.3 or 5.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Relates to another program, environment, or user action which we cannot control.
Projects
None yet
Development

No branches or pull requests

10 participants