Skip to content

fix(tsconfig): treat a missing extends target as non-fatal#1205

Open
webpro wants to merge 1 commit into
oxc-project:mainfrom
webpro:fix/extends-not-found-non-fatal
Open

fix(tsconfig): treat a missing extends target as non-fatal#1205
webpro wants to merge 1 commit into
oxc-project:mainfrom
webpro:fix/extends-not-found-non-fatal

Conversation

@webpro

@webpro webpro commented Jun 6, 2026

Copy link
Copy Markdown

Summary

With tsconfig: 'auto' (or an explicit config), oxc-resolver returns no result for every specifier under a tsconfig whose extends target can't be resolved — a package that isn't installed, or a generated config that doesn't exist yet (e.g. Nuxt's .nuxt/tsconfig*.json before nuxt prepare, or any config on a fresh clone before deps are installed).

tsc / typescript-go report TS6053 ("File … not found") and keep resolving with the options that did parse. This makes oxc-resolver match that.

Closes #1185.

Change

Skip a missing extends base and carry on, rather than failing:

  • a bare-package base that resolves to TsconfigNotFound, and
  • a missing relative target.

Still fatal / unchanged: unreadable (IOError) and malformed (Json) bases; circular extends; missing references.

Reproduction

// tsconfig.json
{ "extends": "@acme/not-installed/tsconfig.json" } // or "./.nuxt/tsconfig.app.json" before `nuxt prepare`
// a.ts
import { b } from './b'; // plain relative — does not depend on the tsconfig

resolve_file("a.ts", "./b") with tsconfig: 'auto':

  • before: Err(TsconfigNotFound("@acme/not-installed/tsconfig.json"))
  • after: Ok(".../b.ts") — matching tsc/tsgo

Tests

  • New: test_extend_package_not_found_still_resolves, test_extend_relative_not_found_still_resolves.
  • Flipped to the new behavior: test_extend_tsconfig_not_found and the undefined-#-import case in test_extend_imports (now Ok); the extends-not-found row in tsconfig_paths (now NotFound("ts-path")).
  • Excluded extends-not-found from the tsconfck parse/invalid set — tsconfck classifies a missing extends as invalid; tsc/tsgo don't.

This is independent of the extends-inherited include/rootDirs fix (separate PR) and does not touch the references path.

…ject#1185)

`tsconfig: 'auto'` (or an explicit config) returned no result for every
specifier under a tsconfig whose `extends` target can't be resolved — a package
that isn't installed, or a generated config that doesn't exist yet (e.g. Nuxt's
`.nuxt/tsconfig*.json` before `nuxt prepare`). tsc / typescript-go report TS6053
and keep resolving with the options that parsed.

Skip a missing `extends` base — both a bare-package `TsconfigNotFound` and a
missing relative target — and carry on. Unreadable (`IOError`) and malformed
(`Json`) bases stay fatal; circular `extends` and missing `references` are
unaffected.

Also flips the two tests that asserted the old fatal behavior, and excludes the
`extends-not-found` case from the tsconfck `parse/invalid` conformance set
(tsconfck classifies a missing extends as invalid; tsc/tsgo don't).
@Boshen Boshen self-assigned this Jun 6, 2026
@Boshen

Boshen commented Jun 6, 2026

Copy link
Copy Markdown
Member

This is a hard one, I'll get to this soon.

@webpro

webpro commented Jun 6, 2026

Copy link
Copy Markdown
Author

Opened the PR because went through a few rabbit holes this morning, Claude still had good context and figured a PR might help. No hurries from our end.

For context: got triggered by webpro-nl/knip#1778 and pushed a workaround over there. If patches ship with oxc-resolver, I've verified we can remove this: webpro-nl/knip@91d6999

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 this pull request may close these issues.

resolveFileSync returns no result when the discovered tsconfig has an unresolvable extends (tsgo still resolves)

2 participants