Course contentsShow
← TypeScript
Lesson 1241 of 1,79629. The Build PipelineFree lesson

Vite and Modern Bundler Workflows

See how Vite uses esbuild for dev and Rollup for production while keeping tsc for type checks.

Vite and Modern Bundler Workflows

What you'll learn: How Vite uses different tools for development and production while keeping TypeScript type-checking separate.

The Development vs Production Split

Modern bundlers like Vite take a hybrid approach to TypeScript. Think of it like a restaurant with two kitchens: one for quick taste-testing during recipe development (fast but less refined), and another for the final plated dish served to customers (slower but polished).

In development, Vite uses esbuild — an extremely fast transpiler written in Go. It strips away TypeScript types almost instantly, giving you near-instant hot module reloading. However, esbuild does not type-check your code. It's like a speed reader who skips the proofreading.

In production, Vite switches to Rollup for building your final bundle. Rollup provides better optimization, tree-shaking, and code-splitting. It also doesn't type-check — it focuses purely on creating the smallest, most efficient JavaScript bundle.

Where Type-Checking Happens

Here's the crucial part: Vite runs tsc (the TypeScript compiler) separately, in parallel, only for type-checking using the --noEmit flag. This means:

  • esbuild/Rollup handles transpilation (types → JavaScript)
  • tsc handles validation (catching type errors)
  • These processes run independently

You might run tsc --noEmit manually, or configure your editor to run it continuously, or add it as a separate script in your build pipeline. The build doesn't wait for type-checking to complete before serving your dev server.

Key takeaway: Vite achieves blazing-fast development by using esbuild for instant type stripping and Rollup for optimized production builds, while delegating actual type safety to tsc running in the background — a separation that prioritizes speed without abandoning type safety.