Skip to content

docs: clarify tsconfig resolution for each file - #22744

Merged
sapphi-red merged 3 commits into
mainfrom
06-23-docs_clarify_tsconfig_resolution_for_each_file
Jun 26, 2026
Merged

docs: clarify tsconfig resolution for each file#22744
sapphi-red merged 3 commits into
mainfrom
06-23-docs_clarify_tsconfig_resolution_for_each_file

Conversation

@shulaoda

Copy link
Copy Markdown
Member

Description

Follow-up to #22695 (upgrade to Rolldown 1.1.2). The old wording "Vite uses the tsconfig.json in the closest parent directory" was inaccurate: Vite walks up the directory tree and uses the closest tsconfig.json that matches the file, not simply the closest one.

The docs now state that:

  • A config matches based on its files, include, and exclude fields, or those of one of its references.
  • The search continues upward when a config doesn't match.
  • No options are applied when no tsconfig.json matches the file.

Docs-only change.

Notes for reviewers

Reference: #22695, Rolldown v1.1.2, and the tsconfig input option docs.

@shulaoda
shulaoda marked this pull request as ready for review June 23, 2026 02:01
@shulaoda
shulaoda requested a review from sapphi-red June 24, 2026 01:41
Comment thread docs/guide/features.md Outdated
Comment on lines +56 to +60
Vite respects some of the options in `tsconfig.json` and sets the corresponding Oxc Transformer options. For each file, Vite uses the closest parent `tsconfig.json` that matches the file:

- A `tsconfig.json` matches when the file satisfies its [`files`](https://www.typescriptlang.org/tsconfig/#files), [`include`](https://www.typescriptlang.org/tsconfig/#include), and [`exclude`](https://www.typescriptlang.org/tsconfig/#exclude) fields, or those of one of the config files listed in its [`references`](https://www.typescriptlang.org/tsconfig/#references) field.
- If a `tsconfig.json` doesn't match, Vite keeps searching parent directories upward.
- If no `tsconfig.json` matches the file, none of these options are applied.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Vite respects some of the options in `tsconfig.json` and sets the corresponding Oxc Transformer options. For each file, Vite uses the closest parent `tsconfig.json` that matches the file:
- A `tsconfig.json` matches when the file satisfies its [`files`](https://www.typescriptlang.org/tsconfig/#files), [`include`](https://www.typescriptlang.org/tsconfig/#include), and [`exclude`](https://www.typescriptlang.org/tsconfig/#exclude) fields, or those of one of the config files listed in its [`references`](https://www.typescriptlang.org/tsconfig/#references) field.
- If a `tsconfig.json` doesn't match, Vite keeps searching parent directories upward.
- If no `tsconfig.json` matches the file, none of these options are applied.
Vite respects some of the options in `tsconfig.json` and sets the corresponding Oxc Transformer options. For each file, Vite uses the closest parent `tsconfig.json` or the config referenced by the [`references`](https://www.typescriptlang.org/tsconfig/#references) field in them if that config matches the file. Vite treats the config to match a file when the file satisfies the config's [`files`](https://www.typescriptlang.org/tsconfig/#files), [`include`](https://www.typescriptlang.org/tsconfig/#include), and [`exclude`](https://www.typescriptlang.org/tsconfig/#exclude) fields.

I think the last 2 items are already implied in the sentence.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on merging into one paragraph and dropping the "no match, no options" part as implied. I'd just keep the wording as the closest parent tsconfig.json that matches the file (relative clause) rather than if that config matches, so the walk-up when it doesn't match isn't lost.

@sapphi-red sapphi-red added the documentation Improvements or additions to documentation label Jun 25, 2026
shulaoda and others added 2 commits June 25, 2026 21:31
@sapphi-red
sapphi-red merged commit 84926bd into main Jun 26, 2026
16 checks passed
@sapphi-red
sapphi-red deleted the 06-23-docs_clarify_tsconfig_resolution_for_each_file branch June 26, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants