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?
- Sets
moduleResolutiontoBundlerso TypeScript resolves imports the same way Vite does. - Allows native TypeScript file extensions in imports used by Vite-loaded configuration modules.
- Enables
isolatedModulesso each file type-checks safely under Vite's per-file transpilation. - Ships browser
libdefaults so DOM andESNextglobals are available without extra wiring. - Leaves output ownership to the selected role instead of mixing build policy into a tool preset.
- Sits last in the
extendschain so its bundler-oriented settings layer cleanly over the other presets.
Usage
Add the preset as the final entry in your tsconfig.json extends chain, after the essentials, strict, role, and runtime layers.
tsconfig.json
{
"extends": [
"@cbnventures/nova/presets/tsconfig/dx-essentials.json",
"@cbnventures/nova/presets/tsconfig/dx-strict.json",
"@cbnventures/nova/presets/tsconfig/role-app.json",
"@cbnventures/nova/presets/tsconfig/runtime-browser.json",
"@cbnventures/nova/presets/tsconfig/tool-vite.json"
],
"compilerOptions": {
"paths": {
"@/*": [
"./src/*"
]
},
"rootDir": "./",
"types": [
"vite/client"
]
},
"include": [
"./*",
"./src/**/*"
],
"exclude": [
"./build/**",
"./node_modules/**"
]
}
What This Preset Configures
The preset sets the following compilerOptions to match Vite's bundler-driven workflow.
| Setting | Value | Description |
|---|---|---|
allowImportingTsExtensions | true | Accepts explicit .ts, .mts, and .tsx imports in Vite-loaded modules. |
isolatedModules | true | Enforces 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. |
Related
- Review the layering order in TSConfig Best Practices.
- See how presets compose end to end in the Presets Overview.