Skip to main content

Runtime - Node

Add the Node ESM module resolution and ESNext lib that code running on Node.js needs, layered on top of the Nova baseline and strict presets.

Why Use This Preset?

  1. Pairs module and moduleResolution as NodeNext so imports resolve the same way TypeScript and Node do at runtime.
  2. Loads the ESNext lib alone, with no DOM globals, so browser-only APIs stay out of server code.
  3. Uses Node's current module detection so emitted ESM and CommonJS match how Node treats each file.
  4. 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
json
{
  "extends": [
    "@cbnventures/nova/presets/tsconfig/dx-essentials.json",
    "@cbnventures/nova/presets/tsconfig/dx-strict.json",
    "@cbnventures/nova/presets/tsconfig/runtime-node.json"
  ]
}

What This Preset Configures

The preset sets the following compilerOptions, overriding the matching values from the layers below it.

SettingValueDescription
libESNextLoads the latest built-in JavaScript types with no DOM globals.
moduleNodeNextEmits modules using Node's current ESM and CommonJS detection.
moduleResolutionNodeNextResolves imports the way Node does, matched to the module setting.

info

The lib array replaces the parent value rather than merging with it, so this preset restates ESNext even though the baseline already sets it.