vite tsconfig

tsconfig for Vite

Generate a TypeScript config starter for Vite React and modern browser apps.

Open tsconfig Builder

Vite-friendly settings

Vite projects usually want DOM libs, modern module output, bundler resolution, class field semantics, React JSX when relevant, and noEmit so Vite owns bundling.

When to split configs

Use separate app and node configs when a Vite project also has test, build, or script files that run outside the browser.

React app starter

For a Vite React app, keep JSX handling, DOM libs, and bundler resolution aligned with the Vite compiler rather than Node runtime defaults.

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "moduleResolution": "bundler",
    "lib": ["DOM", "DOM.Iterable", "ES2022"],
    "useDefineForClassFields": true
  }
}

Test and tooling files

Vitest, Playwright, build scripts, and config files may run in Node. Give those files a separate tsconfig if they need Node types or different module settings.

Strict browser code

Strict mode is a good default for Vite apps because UI state, fetched JSON, and component props benefit from early null and shape checks.

Before committing

Run the Vite build, tests, and any explicit typecheck command. Verify aliases match both TypeScript and Vite config so editor imports behave like production builds.

Vite tsconfig decisions

NeedRecommended settingReview note
Browser APIs`lib` includes `DOM` and modern ECMAScript.Needed for React, fetch, and browser globals.
Bundled imports`moduleResolution: bundler`Matches Vite's dependency and path handling.
Class fields`useDefineForClassFields: true`Matches Vite's modern class field semantics.
Build output`noEmit: true`Vite handles emitted assets and JavaScript.
Node scriptsSeparate node tsconfigAvoid mixing DOM and Node-only assumptions.

Use FrameworkKit to generate the starter code, then review the output before shipping it in production.

Generate with tsconfig Builder

tsconfig resources

FAQ

Should Vite use moduleResolution bundler?

Usually yes. Vite resolves imports through a bundler, so `bundler` better matches app behavior than Node-specific resolution.

Does Vite need noEmit?

Most Vite apps use `noEmit: true` because Vite handles output and TypeScript checks types.

Why split app and node tsconfigs?

Browser code and tooling code often need different globals, libs, and module assumptions. Splitting avoids accidental type leakage.

Can this config be used for Vue or Svelte?

Use it as a baseline, then adapt JSX and framework-specific plugin requirements for your Vite stack.

Related comparisons

Related tools