-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
tsconfig not found when extends scope with ts-node>10.0 and typescript@>=5.3.0-dev #2076
Comments
I have ran into this issue with the latest release of 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
|
I added reproduction with the latest 5.3.2 version of typescript: TypeStrong/ts-node-repros#36 |
This issue has also been reported to TypeScript it seems; microsoft/TypeScript#56492 |
Hello, yes, that is the same issue. I debugged the issue and posted the culprit there: |
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: #2091 |
Hi all, I modified the tsconfig.json's extends path as follows: In my case I am using:
And it works |
@patozavala yes, I can confirm this workaround, I found it as well but forgot to post 😅 sorry |
This also affects Jest with TypeScript configuration files, because Jest uses |
Workaround (apply patch before PR merged)To apply the patch directly before #2091 is merged (eg. using
function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiagnostic) {
extendedConfig = (0, util_1.normalizeSlashes)(extendedConfig);
if (isRootedDiskPath(extendedConfig) ||
startsWith(extendedConfig, './') ||
startsWith(extendedConfig, '../')) {
let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
if (!host.fileExists(extendedConfigPath) &&
!endsWith(extendedConfigPath, ts.Extension.Json)) {
extendedConfigPath = `${extendedConfigPath}.json`;
if (!host.fileExists(extendedConfigPath)) {
errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
}
return extendedConfigPath;
}
// If the path isn't a rooted or relative path, resolve like a module
const resolved = ts.nodeModuleNameResolver(extendedConfig, combinePaths(basePath, 'tsconfig.json'), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host,
/*cache*/ undefined,
/*projectRefs*/ undefined,
+ /*conditionsOrIsConfigLookup*/ undefined,
/*lookupConfig*/ true);
if (resolved.resolvedModule) {
return resolved.resolvedModule.resolvedFileName;
}
errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
return { getExtendsConfigPath };
} |
I couldn't bump TS because of TypeStrong/ts-node#2076 Couldn't bump react-helmet-async because the ESM SSR output doesn't run in Node anymore...
Could a new 11.beta release be cut with this fix included please? Thanks! |
…er handling of `extends` array bug See: TypeStrong/ts-node#2076 See: TypeStrong/ts-node#2000
I face this issue with jest right now. Is there any workaround or fix already available? I'm on the latest (29.7.0) jest version |
for people using yarn (berry) you can use https://www.npmjs.com/package/ts-node/v/11.0.0-beta.1 with the following patch: diff --git a/dist/ts-internals.js b/dist/ts-internals.js
index 2b303c90edf91dcc3bf9988586570b9988f05187..99ea07b39a0fb1801a3bdc7ee6234b5d0f432c3f 100644
--- a/dist/ts-internals.js
+++ b/dist/ts-internals.js
@@ -34,9 +34,10 @@ function createTsInternalsUncached(_ts) {
return extendedConfigPath;
}
// If the path isn't a rooted or relative path, resolve like a module
- const resolved = ts.nodeModuleNameResolver(extendedConfig, combinePaths(basePath, 'tsconfig.json'), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host,
- /*cache*/ undefined,
- /*projectRefs*/ undefined,
+ const resolved = ts.nodeModuleNameResolver(extendedConfig, combinePaths(basePath, 'tsconfig.json'), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host,
+ /*cache*/ undefined,
+ /*projectRefs*/ undefined,
+ /*conditionsOrIsConfigLookup*/ undefined,
/*lookupConfig*/ true);
if (resolved.resolvedModule) {
return resolved.resolvedModule.resolvedFileName;
`` |
This was fixed for me by updating from ts-node 10.9.1 to 10.9.2 - just remove ts-node from your lockfile and run install again. I'm writing so people aren't confused - 10.9.2 was released after 11.0.0 beta, so this is probably why the above poster is patching. |
I got it fixed as well by overriding all peer dependencies and update ts-node to 10.9.2 |
Search Terms
not found tsconfig
Expected Behavior
no error like [email protected]
Actual Behavior
Steps to reproduce the problem
global install typescript>=5.3.0-dev
global/local install ts-node@>10.0
node_modules/ts-node/dist/configuration.js
Minimal reproduction
Specifications
The text was updated successfully, but these errors were encountered: