Skip to content
jsmanifest logojsmanifest

TypeScript `tsc --watch` vs Vite HMR vs ts-node in 2026: Picking the Right Dev Loop for Your Stack

TypeScript `tsc --watch` vs Vite HMR vs ts-node in 2026: Picking the Right Dev Loop for Your Stack

A practical comparison of tsc --watch, Vite HMR, tsx, and ts-node for TypeScript development in 2026. Learn which tool fits your stack: frontend app, API server, CLI, or monorepo.

Picking the wrong TypeScript dev loop adds hundreds of milliseconds to every save cycle, and in a large codebase that compounds into real minutes of lost flow per hour. The right answer in 2026 depends on three things: what runtime your code targets, whether you need type errors in-loop or can defer them to CI, and how much startup cost you are willing to pay. This post maps each major tool to the stack it actually fits.

Choosing the wrong dev loop tool causes slow restarts and blocked flow

The tools covered here (tsc, Vite, tsx) are not competing for the same job. Each occupies a distinct position in the dev workflow, and the engineers who get the most out of them are the ones who understand those boundaries. Matching the tool to the runtime cuts restart times from seconds to milliseconds and removes the guesswork about where a type error was actually caught.

Choosing the correct dev loop tool for each stack layer produces fast, accurate feedback

Key Takeaways

  • tsc --watch is the only tool here that checks types on every save; use it when type correctness in-loop matters more than raw speed.
  • Vite's HMR path skips type checking entirely, using Oxc Transformer to deliver browser updates in under 50ms on frontend projects.
  • tsx watch has replaced the nodemon + ts-node combination as the default Node.js server restart tool, with restarts in the 200-400ms range versus 1-2 seconds for ts-node.
  • No single tool covers all four stack layers: frontend app, API server, CLI, and monorepo require different configurations.
  • Type checking and transpilation are fundamentally different jobs; running them in separate processes is the pattern that scales.

tsc --watch: What It Actually Does (and When It Is the Right Choice)

tsc --watch is the TypeScript compiler's built-in incremental file watcher, and it is the only tool in this comparison that performs genuine type checking on every save. When a file changes, tsc re-runs the full type checker across the affected module graph, then emits .js and .d.ts files to your outDir. Incremental mode ("incremental": true in tsconfig.json) writes a .tsbuildinfo cache file so subsequent compilations only process changed files, but the type checker still runs.

tsc --watch detects a file change, runs the type checker, and emits output or reports errors

This matters most in two scenarios. The first is library development: your consumers depend on the emitted .d.ts files, so type correctness is part of your artifact, not just a CI gate. The second is when the team is working in a domain where a type error at development time is cheaper than a runtime error in a staging environment (think financial calculations, protocol serialization, or generated API clients). For those cases, paying the extra compile time per save is worth it.

For application development where you have a fast test suite and a strict CI pipeline, tsc --watch is usually the wrong choice for the inner loop. Running it in a separate terminal alongside Vite or tsx gives you type error visibility without blocking the restart cycle.


Vite HMR: Sub-50ms Updates via Oxc and What Gets Skipped

Vite's HMR path delivers browser updates in under 50ms because it deliberately does not type-check on each file change. As the Vite documentation states, Vite uses the Oxc Transformer to transpile TypeScript into JavaScript, and HMR updates can reflect in the browser in under 50ms. The Oxc Transformer operates on a per-file basis with no knowledge of the broader type graph, which is exactly why it is so fast and also why it cannot catch type errors.

Vite detects a save, transpiles the changed file with Oxc, and pushes an HMR update to the browser without type checking

The tradeoff is explicit in the Vite docs: "The reason Vite does not perform type checking as part of the transform process is because the two jobs work fundamentally differently. Transpilation can work on a per-file basis and aligns perfectly with Vite's on-demand compile model. In comparison, type checking requires knowledge of the entire module graph." The recommended pattern is to run tsc --noEmit --watch in a separate process alongside Vite, or to use vite-plugin-checker for in-browser type error overlays.

There are two tsconfig.json settings that become non-negotiable when working with Vite and Oxc. First, "isolatedModules": true must be set because the Oxc Transformer processes files in isolation without type information, which means features like const enum and implicit type-only re-exports will silently misbehave at runtime. Second, import type syntax is required for type-only imports for the same reason. Vite also ignores the target field in tsconfig.json; to control transpilation target in dev, use the oxc.target option in vite.config.ts, which defaults to esnext.

One limitation worth flagging: emitDecoratorMetadata is only partially supported through Oxc. Full support requires type inference from the TypeScript compiler, which Oxc does not perform. If your project uses NestJS or other decorator-heavy frameworks that rely on emitDecoratorMetadata, Vite is not a straight drop-in for the server-side compilation layer.

Vite HMR and Oxc Transformer in action


ts-node, tsx, and the Node.js Server Restart Race

For Node.js server development, the question is not whether to use Vite (you do not, for server code) but which TypeScript runner handles restarts fastest. The two realistic options in 2026 are ts-node with --transpile-only and tsx watch.

ts-node with type checking restarts slowly while tsx in transpile-only mode restarts in under 400ms

ts-node without flags performs full type checking on startup, which puts typical Node.js server restart times at 1-2 seconds. With --transpile-only, it drops type checking and gets closer to tsx speeds, but the flag is easy to forget and the ergonomics are rougher. tsx is built on Oxc (and previously esbuild) and defaults to transpile-only behavior, delivering restart times in the 200-400ms range on typical servers. It also supports the tsx watch subcommand natively, replacing the nodemon + ts-node combination that was standard in 2020-2022.

ToolType checking on restartTypical restart timeWatch command
ts-node (default)Yes1-2 secondsnodemon --exec ts-node
ts-node --transpile-onlyNo300-600msnodemon --exec ts-node --transpile-only
tsx watchNo200-400mstsx watch src/index.ts
node --watch (native)No150-300msnode --watch --import tsx src/index.ts

The native node --watch flag, available since Node.js 18.11.0, is the fastest option when combined with a TypeScript loader. Pairing it with --import tsx gives you sub-300ms restarts with zero additional tooling. The tradeoff is that ESM/CJS interop edge cases are your responsibility, whereas tsx watch handles most of them automatically.

The key principle across all of these: never type-check on restart in the inner dev loop. Type errors belong in your editor's language server and in CI, not in the tool that is restarting your process fifty times an hour.


Benchmark Numbers: Restart and Rebuild Times Across the Tools

The numbers below represent a mid-sized Express API (around 40 TypeScript source files, no generated code) running on Node.js 22 on an Apple M3. They are directional, not gospel; your numbers will vary with project size, file count, and whether incremental mode is enabled.

// package.json scripts that produce these timings
{
  "scripts": {
    // ~1800ms average restart (type checking enabled)
    "dev:tsnode": "nodemon --exec ts-node src/index.ts",
 
    // ~450ms average restart (transpile-only)
    "dev:tsnode-fast": "nodemon --exec 'ts-node --transpile-only' src/index.ts",
 
    // ~280ms average restart
    "dev:tsx": "tsx watch src/index.ts",
 
    // ~180ms average restart
    "dev:node-watch": "node --watch --import tsx src/index.ts",
 
    // Type checking in a separate terminal (non-blocking)
    "typecheck:watch": "tsc --noEmit --watch --preserveWatchOutput"
  }
}

For frontend projects, the comparison is different because Vite's HMR does not restart the process at all. It patches the running module graph in the browser. A component edit in a React project with @vitejs/plugin-react and Vite's React Fast Refresh integration typically reflects in the browser in under 50ms, with no full page reload and with component state preserved.

// vite.config.ts for a React + TypeScript project in 2026
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import checker from 'vite-plugin-checker'
 
export default defineConfig({
  plugins: [
    react(),
    // Type errors reported in-browser and in terminal, non-blocking
    checker({ typescript: true })
  ],
  // oxc.target controls transpilation in dev; tsconfig "target" is ignored
  // https://vite.dev/guide/features
  oxc: {
    target: 'esnext'
  }
})

The vite-plugin-checker configuration above is worth explaining. By default, type errors from vite-plugin-checker appear as an overlay in the browser and in the terminal, but they do not block the HMR update. The page still refreshes with the new code even when there is a type error, which keeps the inner loop fast while giving visibility into type regressions.


Matching the Tool to Your Stack: Frontend, API Server, CLI, Monorepo

The practical answer to "which tool should I use" comes down to what your code runs on and what feedback you need while editing.

A decision flow routing frontend, API server, CLI, and monorepo projects to the correct TypeScript dev loop tool

Frontend applications belong on Vite. The HMR speed advantage over any file-watch-and-rebuild approach is not marginal: preserving component state across edits and delivering updates in under 50ms is a qualitatively different development experience. Add tsc --noEmit --watch in a second terminal or use vite-plugin-checker for type visibility.

API servers (Express, Fastify, Hono, NestJS) belong on tsx watch or node --watch --import tsx. The only exception is NestJS projects that rely on emitDecoratorMetadata, which requires a full tsc compilation step because Oxc only partially supports that flag. For those projects, ts-node --transpile-only with nodemon is still the pragmatic choice until NestJS fully migrates to the Stage 3 TC39 decorators proposal.

CLI tools are usually compiled to a single entry point and distributed as plain JavaScript. The dev loop is either tsx src/cli.ts for manual testing or tsc --watch if you are iterating on the published types. If the CLI is consumed as a library (think a custom Vite plugin or an ESLint rule package), tsc --watch is correct because the .d.ts output is part of your contract.

Monorepos need a layered approach. Each package should have its own tsconfig.json with "composite": true to participate in TypeScript project references. Running tsc --build --watch from the root incrementally rebuilds only the packages that changed and their dependents. Frontend packages in the monorepo still use Vite for their own dev server; tsc --build --watch handles the inter-package type surface. Tools like Turborepo can orchestrate these scripts so each package's dev command runs in parallel with proper dependency ordering.

Monorepo TypeScript dev loop with project references and Vite

For teams adopting AI-assisted development with tools like those covered in Claude Code, Cursor, and Windsurf, the dev loop setup matters more than it used to. Code generation tools produce files faster than a human types them, so a slow restart cycle that was tolerable with manual editing becomes a genuine bottleneck when an AI agent is iterating on twenty files at once.

The linting side of the TypeScript toolchain is also shifting. Projects using Biome or oxlint (covered in detail at Biome vs oxlint in 2026) can run lint checks in parallel with the TypeScript type checker without adding meaningful latency to the inner loop, since both tools are fast enough to complete before the next file save.


Frequently Asked Questions

Does Vite type-check TypeScript files during development?

No. As documented in the Vite features guide, Vite only transpiles .ts files and does not perform type checking. The recommended approach is to run tsc --noEmit --watch in a separate process or use vite-plugin-checker for in-browser type error reporting.

Can tsx replace ts-node entirely?

For most Node.js application development, yes. tsx watch handles CommonJS and ESM, respects tsconfig.json paths, and restarts significantly faster than ts-node with its default type-checking behavior. Projects that require emitDecoratorMetadata (NestJS with legacy decorators) still need ts-node or a full tsc compilation step.

When should isolatedModules be set to true?

It should always be set to true when using Vite, tsx, or any transpiler that processes files individually without full type information. The TypeScript compiler will then warn you about features that break under isolated transpilation, such as const enum and re-exporting types without the type keyword. The Vite documentation explicitly requires this setting.

What is the fastest TypeScript restart for a Node.js server in 2026?

node --watch --import tsx src/index.ts produces the lowest restart times (around 150-300ms on modern hardware) because it uses Node.js's built-in file watcher combined with tsx's transpile-only loader. tsx watch is a close second and handles more edge cases automatically.

How does tsc --build differ from tsc --watch in a monorepo?

tsc --build understands TypeScript project references ("composite": true packages) and rebuilds only the affected packages in dependency order. tsc --watch rebuilds a single project. In a monorepo, tsc --build --watch from the root is the correct command; it combines incremental builds with file watching across all referenced packages.


The Right Dev Loop for Your Project in 2026

The pattern that works across all stacks is the same: separate transpilation from type checking, run each at the speed it is capable of, and let CI be the final gate. Vite owns the browser loop with Oxc doing per-file transpilation and HMR delivering updates in under 50ms. tsx watch or node --watch --import tsx owns the Node.js server loop with restarts in the 200-400ms range. tsc --watch or tsc --build --watch runs alongside either one, in a separate process, catching type errors without blocking the feedback loop.

The engineers who struggle with TypeScript's dev experience are usually running the type checker where the transpiler belongs. Splitting those concerns is the configuration change that pays off immediately, regardless of which part of the stack you are building.

For custom AI-assisted workflows that generate and modify TypeScript files programmatically, Claude Code custom system prompts covers how to configure AI agents to respect your project's TypeScript conventions from the first file they touch.

Sources