Skip to main content

Tool - Vite

Align TypeScript with how Vite resolves and transpiles your code, so the compiler type-checks while Vite owns the build output.

Why Use This Preset?

  1. Sets moduleResolution to Bundler so TypeScript resolves imports the same way Vite does.
  2. Enables isolatedModules so each file type-checks safely under Vite's per-file transpilation.
  3. Turns on noEmit so TypeScript only checks types and never competes with Vite for build output.
  4. Ships browser lib defaults so DOM and ESNext globals are available without extra wiring.
  5. Sits last in the extends chain so its bundler-oriented settings layer cleanly over the base presets.

Usage

Add the preset as the final entry in your tsconfig.json extends chain, after the essentials, strict, and runtime layers.

tsconfig.json
json
{
  "extends": [
    "@cbnventures/nova/presets/tsconfig/dx-essentials.json",
    "@cbnventures/nova/presets/tsconfig/dx-strict.json",
    "@cbnventures/nova/presets/tsconfig/runtime-browser.json",
    "@cbnventures/nova/presets/tsconfig/tool-vite.json"
  ],
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@/*": [
        "./src/*"
      ]
    },
    "rootDir": "./",
    "types": [
      "vite/client"
    ]
  },
  "include": [
    "./*",
    "./src/**/*"
  ],
  "exclude": [
    "./dist/**",
    "./node_modules/**"
  ]
}

What This Preset Configures

The preset sets the following compilerOptions to match Vite's bundler-driven workflow.

SettingValueDescription
isolatedModulestrueEnforces per-file type safety since Vite transpiles each file alone.
lib["DOM", "DOM.Iterable", "ESNext"]Exposes browser DOM APIs and the latest ESNext library features.
module"ESNext"Emits modern ECMAScript module syntax for the bundler to consume.
moduleResolution"Bundler"Resolves imports the way Vite does, including bare and extensionless paths.
noEmittrueType-checks only and leaves build output to Vite.