Why does Vite create two TypeScript config files: tsconfig.json and tsconfig.node.json?

You need two different TS configs because the project is using two different environments in which the TypeScript code is executed:

  1. Your app (src folder) is targeting (will be running) inside the browser
  2. Vite itself including its config is running on your computer inside Node, which is totally different environment (compared with browser) with different API’s and constraints

So there are two different configs for those two environments and two distinct sets of source files…

And no, you probably don’t want to delete the tsconfig.node.json but you can probably rename it to something like tsconfig.vite.json to make it’s purpose more clear

Leave a Comment