From c2442c74248b404184050b7fceb8d9fc8446fc41 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Mon, 1 Dec 2025 16:07:30 +0900 Subject: [PATCH 1/3] docs: clarify tsconfig resolution behavior --- docs/guide/features.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/guide/features.md b/docs/guide/features.md index c7caead35756f7..f30542d1f907ea 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -53,6 +53,10 @@ export type { T } ### TypeScript Compiler Options +Vite respects some of the options in `tsconfig.json` and sets the corresponding esbuild options. The `tsconfig.json` in the closest parent directory for each file is used. If a [`references`](https://www.typescriptlang.org/tsconfig/#references) field is present in the `tsconfig.json`, those config files are also used. If the config file has [`include`](https://www.typescriptlang.org/tsconfig/#include) or [`exclude`](https://www.typescriptlang.org/tsconfig/#exclude) fields, they are respected. + +When the options are set in both the normal config and the `tsconfig.json`, the value in the config file takes precedence. + Some configuration fields under `compilerOptions` in `tsconfig.json` require special attention. #### `isolatedModules` From 05c0e3b766a5fe24f213febb41e1c2a8039be613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0?= Date: Tue, 2 Dec 2025 12:49:07 +0900 Subject: [PATCH 2/3] chore: update clarify Vite config Co-authored-by: Bjorn Lu --- docs/guide/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/features.md b/docs/guide/features.md index f30542d1f907ea..6d3c81b7630c14 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -55,7 +55,7 @@ export type { T } Vite respects some of the options in `tsconfig.json` and sets the corresponding esbuild options. The `tsconfig.json` in the closest parent directory for each file is used. If a [`references`](https://www.typescriptlang.org/tsconfig/#references) field is present in the `tsconfig.json`, those config files are also used. If the config file has [`include`](https://www.typescriptlang.org/tsconfig/#include) or [`exclude`](https://www.typescriptlang.org/tsconfig/#exclude) fields, they are respected. -When the options are set in both the normal config and the `tsconfig.json`, the value in the config file takes precedence. +When the options are set in both the Vite config and the `tsconfig.json`, the value in the Vite config takes precedence. Some configuration fields under `compilerOptions` in `tsconfig.json` require special attention. From ac193450d8a98505be28e64a91a0f5d51aa99469 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 2 Dec 2025 13:02:06 +0900 Subject: [PATCH 3/3] chore: include&exclude applies to referenced ones only --- docs/guide/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/features.md b/docs/guide/features.md index 6d3c81b7630c14..b8bb9c17ab2698 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -53,7 +53,7 @@ export type { T } ### TypeScript Compiler Options -Vite respects some of the options in `tsconfig.json` and sets the corresponding esbuild options. The `tsconfig.json` in the closest parent directory for each file is used. If a [`references`](https://www.typescriptlang.org/tsconfig/#references) field is present in the `tsconfig.json`, those config files are also used. If the config file has [`include`](https://www.typescriptlang.org/tsconfig/#include) or [`exclude`](https://www.typescriptlang.org/tsconfig/#exclude) fields, they are respected. +Vite respects some of the options in `tsconfig.json` and sets the corresponding esbuild options. For each file, Vite uses the `tsconfig.json` in the closest parent directory. If that `tsconfig.json` contains a [`references`](https://www.typescriptlang.org/tsconfig/#references) field, Vite will use the referenced config file that satisfies the [`include`](https://www.typescriptlang.org/tsconfig/#include) and [`exclude`](https://www.typescriptlang.org/tsconfig/#exclude) fields. When the options are set in both the Vite config and the `tsconfig.json`, the value in the Vite config takes precedence.