Runtime - Browser
Add the browser DOM type definitions and bundler module resolution that code shipped to the browser needs, layered on top of the Nova baseline and strict presets.
Why Use This Preset?
- Loads the
DOMandDOM.Iterablelibs so browser globals likedocument,window, andNodeListiteration type-check without manual wiring. - Sets
moduleResolutiontoBundlerso imports resolve the way a bundler resolves them rather than the way Node does. - Uses
ESNextmodules so your bundler controls the final output format instead of TypeScript downleveling it. - Drops in as the environment layer after the essentials and strict presets so you only declare where the code runs.
Usage
Add the preset as the last entry in the extends array of your tsconfig.json, after the essentials and strict layers.
tsconfig.json
{
"extends": [
"@cbnventures/nova/presets/tsconfig/dx-essentials.json",
"@cbnventures/nova/presets/tsconfig/dx-strict.json",
"@cbnventures/nova/presets/tsconfig/runtime-browser.json"
]
}
What This Preset Configures
The preset sets the following compilerOptions, overriding the matching values from the layers below it.
| Setting | Value | Description |
|---|---|---|
lib | DOM, DOM.Iterable, ESNext | Loads browser DOM globals, DOM iterable types, and the latest JavaScript types. |
module | ESNext | Emits modern ESM and leaves the final format to your bundler. |
moduleResolution | Bundler | Resolves imports the way a bundler does, matched to the module setting. |
info
The lib array replaces the parent value rather than merging with it, so this preset restates ESNext alongside the browser libs.
Related
- Review the layering order in TSConfig Best Practices.
- See how presets compose end to end in the Presets Overview.