tsconfig.node.json should not be included in tsconfig.json references
See original GitHub issueDescribe the bug
The reason I stumbled upon this is because I am using TypeScript Project References and tsc --build
fails with a few type errors like
node_modules/@types/scheduler/tracing.d.ts:102:40 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
102 export function unstable_getCurrent(): Set<Interaction> | null;
~~~
node_modules/@types/react/index.d.ts:230:10 - error TS2456: Type alias 'ReactFragment' circularly references itself.
230 type ReactFragment = Iterable<ReactNode>;
~~~~~~~~~~~~~
in the blank React TypeScript template.
That said, removing { "path": "./tsconfig.node.json" }
from tsconfig.json
does neither seem to break npm run dev
nor npm run build
in the template and then allows tsc --build
to complete successfully. It doesn’t seem like anything actually expects this include to exist? https://github.com/vitejs/vite/pull/6324 doesn’t regress for me with the line removed.
Reproduction
https://stackblitz.com/edit/vite-react-ts?file=package.json
Steps to reproduce
Open https://stackblitz.com/edit/vite-react-ts?file=package.json and run tsc --build
in the terminal

System Info
stackblitz
Used Package Manager
npm
Logs
~/projects/vite-react-ts
❯ tsc --build
node_modules/rollup/dist/rollup.d.ts:199:22 - error TS2304: Cannot find name 'IterableIterator'.
199 getModuleIds: () => IterableIterator<string>;
~~~~~~~~~~~~~~~~
node_modules/rollup/dist/rollup.d.ts:208:13 - error TS2304: Cannot find name 'IterableIterator'.
208 moduleIds: IterableIterator<string>;
~~~~~~~~~~~~~~~~
node_modules/rollup/dist/rollup.d.ts:522:22 - error TS2304: Cannot find name 'IterableIterator'.
522 getModuleIds: () => IterableIterator<string>;
~~~~~~~~~~~~~~~~
node_modules/postcss/lib/lazy-result.d.ts:60:28 - error TS2339: Property 'finally' does not exist on type 'Promise<Result>'.
60 finally: Promise<Result>['finally']
~~~~~~~~~
node_modules/postcss/lib/lazy-result.d.ts:73:8 - error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
73 get [Symbol.toStringTag](): string
~~~~~~
node_modules/postcss/lib/no-work-result.d.ts:23:28 - error TS2339: Property 'finally' does not exist on type 'Promise<Result>'.
23 finally: Promise<Result>['finally']
~~~~~~~~~
node_modules/postcss/lib/no-work-result.d.ts:25:8 - error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
25 get [Symbol.toStringTag](): string
~~~~~~
node_modules/vite/dist/node/index.d.ts:3:28 - error TS2307: Cannot find module 'http' or its corresponding type declarations.
3 import type { Agent } from 'http';
~~~~~~
node_modules/vite/dist/node/index.d.ts:5:36 - error TS2307: Cannot find module 'http' or its corresponding type declarations.
5 import type { ClientRequest } from 'http';
~~~~~~
node_modules/vite/dist/node/index.d.ts:6:40 - error TS2307: Cannot find module 'http' or its corresponding type declarations.
6 import type { ClientRequestArgs } from 'http';
~~~~~~
node_modules/vite/dist/node/index.d.ts:8:29 - error TS2307: Cannot find module 'stream' or its corresponding type declarations.
8 import type { Duplex } from 'stream';
~~~~~~~~
node_modules/vite/dist/node/index.d.ts:9:36 - error TS2307: Cannot find module 'stream' or its corresponding type declarations.
9 import type { DuplexOptions } from 'stream';
~~~~~~~~
node_modules/vite/dist/node/index.d.ts:11:30 - error TS2307: Cannot find module 'events' or its corresponding type declarations.
11 import { EventEmitter } from 'events';
~~~~~~~~
node_modules/vite/dist/node/index.d.ts:12:25 - error TS2307: Cannot find module 'events' or its corresponding type declarations.
12 import * as events from 'events';
~~~~~~~~
node_modules/vite/dist/node/index.d.ts:14:26 - error TS2307: Cannot find module 'fs' or its corresponding type declarations.
14 import type * as fs from 'fs';
~~~~
node_modules/vite/dist/node/index.d.ts:16:23 - error TS2307: Cannot find module 'http' or its corresponding type declarations.
16 import * as http from 'http';
~~~~~~
node_modules/vite/dist/node/index.d.ts:17:38 - error TS2307: Cannot find module 'http' or its corresponding type declarations.
17 import type { IncomingMessage } from 'http';
~~~~~~
node_modules/vite/dist/node/index.d.ts:22:27 - error TS2307: Cannot find module 'net' or its corresponding type declarations.
22 import type * as net from 'net';
~~~~~
node_modules/vite/dist/node/index.d.ts:23:42 - error TS2307: Cannot find module 'http' or its corresponding type declarations.
23 import type { OutgoingHttpHeaders } from 'http';
~~~~~~
node_modules/vite/dist/node/index.d.ts:36:43 - error TS2307: Cannot find module 'tls' or its corresponding type declarations.
36 import type { SecureContextOptions } from 'tls';
~~~~~
node_modules/vite/dist/node/index.d.ts:37:29 - error TS2307: Cannot find module 'http' or its corresponding type declarations.
37 import type { Server } from 'http';
~~~~~~
node_modules/vite/dist/node/index.d.ts:38:41 - error TS2307: Cannot find module 'https' or its corresponding type declarations.
38 import type { Server as Server_2 } from 'https';
~~~~~~~
node_modules/vite/dist/node/index.d.ts:39:41 - error TS2307: Cannot find module 'net' or its corresponding type declarations.
39 import type { Server as Server_3 } from 'net';
~~~~~
node_modules/vite/dist/node/index.d.ts:40:55 - error TS2307: Cannot find module 'https' or its corresponding type declarations.
40 import type { ServerOptions as ServerOptions_2 } from 'https';
~~~~~~~
node_modules/vite/dist/node/index.d.ts:41:37 - error TS2307: Cannot find module 'http' or its corresponding type declarations.
41 import type { ServerResponse } from 'http';
~~~~~~
node_modules/vite/dist/node/index.d.ts:44:30 - error TS2307: Cannot find module 'stream' or its corresponding type declarations.
44 import type * as stream from 'stream';
~~~~~~~~
node_modules/vite/dist/node/index.d.ts:48:27 - error TS2307: Cannot find module 'url' or its corresponding type declarations.
48 import type * as url from 'url';
~~~~~
node_modules/vite/dist/node/index.d.ts:49:35 - error TS2307: Cannot find module 'url' or its corresponding type declarations.
49 import type { URL as URL_2 } from 'url';
~~~~~
node_modules/vite/dist/node/index.d.ts:51:34 - error TS2307: Cannot find module 'zlib' or its corresponding type declarations.
51 import type { ZlibOptions } from 'zlib';
~~~~~~
node_modules/vite/dist/node/index.d.ts:273:21 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
273 importedAssets: Set<string>;
~~~
node_modules/vite/dist/node/index.d.ts:274:18 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
274 importedCss: Set<string>;
~~~
node_modules/vite/dist/node/index.d.ts:377:37 - error TS2503: Cannot find namespace 'NodeJS'.
377 export interface Server extends NodeJS.EventEmitter {
~~~~~~
node_modules/vite/dist/node/index.d.ts:808:15 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
808 pfx?: Buffer | string
~~~~~~
node_modules/vite/dist/node/index.d.ts:1154:21 - error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1154 urlToModuleMap: Map<string, ModuleNode>;
~~~
node_modules/vite/dist/node/index.d.ts:1155:20 - error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1155 idToModuleMap: Map<string, ModuleNode>;
~~~
node_modules/vite/dist/node/index.d.ts:1156:23 - error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1156 fileToModulesMap: Map<string, Set<ModuleNode>>;
~~~
node_modules/vite/dist/node/index.d.ts:1156:35 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1156 fileToModulesMap: Map<string, Set<ModuleNode>>;
~~~
node_modules/vite/dist/node/index.d.ts:1157:22 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1157 safeModulesPath: Set<string>;
~~~
node_modules/vite/dist/node/index.d.ts:1161:37 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1161 getModulesByFile(file: string): Set<ModuleNode> | undefined;
~~~
node_modules/vite/dist/node/index.d.ts:1163:46 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1163 invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number): void;
~~~
node_modules/vite/dist/node/index.d.ts:1170:56 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1170 updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, acceptedModules: Set<string | ModuleNode>, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
~~~
node_modules/vite/dist/node/index.d.ts:1170:99 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1170 updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, acceptedModules: Set<string | ModuleNode>, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
~~~
node_modules/vite/dist/node/index.d.ts:1170:175 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1170 updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, acceptedModules: Set<string | ModuleNode>, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
~~~
node_modules/vite/dist/node/index.d.ts:1189:16 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1189 importers: Set<ModuleNode>;
~~~
node_modules/vite/dist/node/index.d.ts:1190:22 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1190 importedModules: Set<ModuleNode>;
~~~
node_modules/vite/dist/node/index.d.ts:1191:22 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1191 acceptedHmrDeps: Set<ModuleNode>;
~~~
node_modules/vite/dist/node/index.d.ts:1229:36 - error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1229 export declare type PackageCache = Map<string, PackageData>;
~~~
node_modules/vite/dist/node/index.d.ts:1364:16 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1364 skip?: Set<Plugin>;
~~~
node_modules/vite/dist/node/index.d.ts:1711:91 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
1711 export declare function send(req: IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, options: SendOptions): void;
~~~~~~
node_modules/vite/dist/node/index.d.ts:1769:12 - error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
1769 cache: Map<string, boolean>;
~~~
node_modules/vite/dist/node/index.d.ts:2387:42 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2387 close(code?: number, data?: string | Buffer): void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2457:55 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2457 listener: (this: WebSocket, code: number, reason: Buffer) => void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2475:39 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2475 listener: (this: WebSocket, data: Buffer) => void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2492:55 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2492 listener: (this: WebSocket, code: number, reason: Buffer) => void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2510:39 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2510 listener: (this: WebSocket, data: Buffer) => void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2527:55 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2527 listener: (this: WebSocket, code: number, reason: Buffer) => void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2545:39 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2545 listener: (this: WebSocket, data: Buffer) => void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2562:38 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2562 listener: (code: number, reason: Buffer) => void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2574:58 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2574 addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
~~~~~~
node_modules/vite/dist/node/index.d.ts:2583:38 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2583 listener: (code: number, reason: Buffer) => void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2595:61 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2595 removeListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
~~~~~~
node_modules/vite/dist/node/index.d.ts:2610:27 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2610 export type RawData = Buffer | ArrayBuffer | Buffer[]
~~~~~~
node_modules/vite/dist/node/index.d.ts:2610:50 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2610 export type RawData = Buffer | ArrayBuffer | Buffer[]
~~~~~~
node_modules/vite/dist/node/index.d.ts:2615:33 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2615 export type Data = string | Buffer | ArrayBuffer | Buffer[]
~~~~~~
node_modules/vite/dist/node/index.d.ts:2615:56 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2615 export type Data = string | Buffer | ArrayBuffer | Buffer[]
~~~~~~
node_modules/vite/dist/node/index.d.ts:2620:48 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2620 export type CertMeta = string | string[] | Buffer | Buffer[]
~~~~~~
node_modules/vite/dist/node/index.d.ts:2620:57 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2620 export type CertMeta = string | string[] | Buffer | Buffer[]
~~~~~~
node_modules/vite/dist/node/index.d.ts:2651:29 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2651 generateMask?(mask: Buffer): void
~~~~~~
node_modules/vite/dist/node/index.d.ts:2682:26 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2682 dictionary?: Buffer | Buffer[] | DataView | undefined
~~~~~~
node_modules/vite/dist/node/index.d.ts:2682:35 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2682 dictionary?: Buffer | Buffer[] | DataView | undefined
~~~~~~
node_modules/vite/dist/node/index.d.ts:2731:20 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
2731 protocols: Set<string>,
~~~
node_modules/vite/dist/node/index.d.ts:2753:18 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
2753 clients: Set<T>
~~~
node_modules/vite/dist/node/index.d.ts:2762:22 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
2762 upgradeHead: Buffer,
~~~~~~
node_modules/vite/dist/node/index.d.ts:2879:14 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
2879 clients: Set<WebSocketClient>;
~~~
node_modules/vite/dist/node/index.d.ts:1:23 - error TS2688: Cannot find type definition file for 'node'.
1 /// <reference types="node" />
~~~~
node_modules/@types/prop-types/index.d.ts:20:41 - error TS2304: Cannot find name 'Iterable'.
20 export interface ReactNodeArray extends Iterable<ReactNodeLike> {}
~~~~~~~~
node_modules/@types/scheduler/tracing.d.ts:64:35 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
64 onWorkScheduled: (interactions: Set<Interaction>, threadID: number) => void;
~~~
node_modules/@types/scheduler/tracing.d.ts:70:34 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
70 onWorkCanceled: (interactions: Set<Interaction>, threadID: number) => void;
~~~
node_modules/@types/scheduler/tracing.d.ts:80:33 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
80 onWorkStarted: (interactions: Set<Interaction>, threadID: number) => void;
~~~
node_modules/@types/scheduler/tracing.d.ts:86:33 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
86 onWorkStopped: (interactions: Set<Interaction>, threadID: number) => void;
~~~
node_modules/@types/scheduler/tracing.d.ts:90:12 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
90 current: Set<Interaction>;
~~~
node_modules/@types/scheduler/tracing.d.ts:102:40 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
102 export function unstable_getCurrent(): Set<Interaction> | null;
~~~
node_modules/@types/react/index.d.ts:228:10 - error TS2456: Type alias 'ReactFragment' circularly references itself.
228 type ReactFragment = Iterable<ReactNode>;
~~~~~~~~~~~~~
node_modules/@types/react/index.d.ts:228:26 - error TS2304: Cannot find name 'Iterable'.
228 type ReactFragment = Iterable<ReactNode>;
~~~~~~~~
node_modules/@types/react/index.d.ts:229:10 - error TS2456: Type alias 'ReactNode' circularly references itself.
229 type ReactNode = ReactChild | ReactFragment | ReactPortal | boolean | null | undefined;
~~~~~~~~~
node_modules/@types/react/index.d.ts:412:23 - error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
412 interactions: Set<SchedulerInteraction>,
~~~
Found 86 errors.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Documentation - What is a tsconfig.json - TypeScript
The tsconfig.json file specifies the root files and the compiler options required to compile the project. JavaScript projects can use a jsconfig.json file ......
Read more >Why does Vite create two TypeScript config files: tsconfig.json ...
You need two different TS configs because the project is using two different environments in which the TypeScript code is executed:.
Read more >Project references with --build ignoring include/exclude paths.
I think I actually figured this out - it appears my base tsconfig not having a files: [] entry was overriding the project...
Read more >Breaking down TypeScript project references | by Jake Ginnivan
json. This file is for project references projects, we will leave tsconfig.base.json in place for ts-node and other similar tools.
Read more >tsconfig.json - TypeScript - JavaScript that scales.
This tsconfig.json file will only include ./node_modules/@types/node , ./node_modules/@types/lodash and ./node_modules ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It was my first assumption as well since
tsconfig.node.json
only includesvite.config.ts
. However, you can deletetsconfig.node.json
and bothvite build
andvite preview
still work fine without errors. I also tried grep and GitHub search and no code anywhere seems to referencetsconfig.node.json
(excepttsconfig.json
where again you can remove that reference and nothing breaks).vite.config.ts is bundled by vite with esbuild. so that config is used.