ts-node: tsconfig not found when extends scope with ts-node>10.0 and typescript@>=5.3.0-dev
Search Terms
not found tsconfig
Expected Behavior
no error like ts-node@10.0
Actual Behavior
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
error TS6053: File '@bluelovers/tsconfig/esm/mapfile.json' not found.
at createTSError (C:\Users\User\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:859:12)
at reportTSError (C:\Users\User\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:863:19)
at createFromPreloadedConfig (C:\Users\User\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:874:36)
at phase4 (C:\Users\User\AppData\Roaming\npm\node_modules\ts-node\src\bin.ts:543:44)
at bootstrap (C:\Users\User\AppData\Roaming\npm\node_modules\ts-node\src\bin.ts:95:10)
at main (C:\Users\User\AppData\Roaming\npm\node_modules\ts-node\src\bin.ts:55:10)
at Object.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\ts-node\src\bin-cwd.ts:5:5)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32) {
diagnosticCodes: [ 6053 ]
}
Steps to reproduce the problem
global install typescript>=5.3.0-dev global/local install ts-node@>10.0
{
"extends": "@bluelovers/tsconfig/esm/mapfile.json",
"compilerOptions": {
"disableReferencedProjectLoad": true,
"importHelpers": true,
"noPropertyAccessFromIndexSignature": false
}
}
node_modules/ts-node/dist/configuration.js
const resolvedExtendedConfigPath = tsInternals.getExtendsConfigPath(c.extends, {
fileExists,
readDirectory: ts.sys.readDirectory,
readFile,
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
trace: tsTrace,
}, bp, errors, ts.createCompilerDiagnostic);
Minimal reproduction
Specifications
- ts-node version:
- node version:
- TypeScript version:
- tsconfig.json, if you’re using one:
{}
- package.json:
{}
- Operating system and version:
- If Windows, are you using WSL or WSL2?:
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Reactions: 45
- Comments: 16 (3 by maintainers)
Commits related to this issue
- fix: stick to ts 5.2 See https://github.com/TypeStrong/ts-node/issues/2076 — committed to adonisjs/web-starter-kit by Julien-R44 7 months ago
- fix: stick to 5.2 See https://github.com/TypeStrong/ts-node/issues/2076 — committed to adonisjs/slim-starter-kit by Julien-R44 7 months ago
- Revert "Bump typescript from 5.2.2 to 5.3.2 (#1404)" Refs: https://github.com/TypeStrong/ts-node/issues/2076; reverts fd0a63a5bc01bef4580ceab289287f00dbeb5a4d — committed to PREreview/prereview.org by erkannt 7 months ago
- chore: bump dependencies I couldn't bump TS because of https://github.com/TypeStrong/ts-node/issues/2076 Couldn't bump react-helmet-async because the ESM SSR output doesn't run in Node anymore... — committed to Josh-Cena/Josh-Cena.github.io by Josh-Cena 7 months ago
- chore(update): adjust for `ts-node` fix of relative bases issue, better handling of `extends` array bug See: TypeStrong/ts-node#2076 See: TypeStrong/ts-node#2000 — committed to 10mi2/tms-projen-projects by giseburt 7 months ago
Hi all,
I modified the tsconfig.json’s extends path as follows: before:
"extends": "ts-node/node16/tsconfig.json",
after:"extends": "./node_modules/@tsconfig/node16/tsconfig.json",
In my case I am using:
And it works
I have ran into this issue with the latest release of
typescript@5.3.2
https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/ts-node version: v10.9.1
5.3.2 just went live 8 hours ago and i got the similar error with extending @tsconfig/node18
tsconfig.json
Workaround (apply patch before PR merged)
To apply the patch directly before #2091 is merged (eg. using
patch-package
orpnpm patch
):node_modules/ts-node/dist/ts-internals.js
Hello, yes, that is the same issue. I debugged the issue and posted the culprit there: https://github.com/microsoft/TypeScript/issues/56492#issuecomment-1823213512
Could a new 11.beta release be cut with this fix included please? Thanks!
I guess we need to accommodate for this internal API change by providing different arguments based on the Typescript version being used.
I started the work here: https://github.com/TypeStrong/ts-node/pull/2091
This also affects Jest with TypeScript configuration files, because Jest uses
ts-node
by default