Skip to main content

Runtimes

TypeScript is supported by multiple runtimes: Node.js (via tsx), Deno (natively) and Bun (natively).

By default, the TypeScript SDK executes functions using the Node.js runtime, but you can configure an alternative runtime in the package.json file.

note

For now, the TypeScript SDK only supports Node.js (stable) and Bun (experimental).

To change the TypeScript SDK runtime, set the field dagger.runtime in the package.json file.

Node

Set the field to node to use the Node.js runtime. Node.js is also the default runtime used if this field is omitted.

  "dagger": {
"runtime": "node"
}

Bun

Set the field to bun to use the Bun runtime.

  "dagger": {
"runtime": "bun"
}
warning

Bun runtime support is still experimental. Unexpected results may occur in some cases.

Automatic Detection

When a runtime is not explicitly defined within the package.json file, Dagger automatically identifies the appropriate runtime by examining the project's lock files inside the project's dagger directory.

  • If Dagger finds any of the following lock files : package-lock.json, yarn.lock, or pnpm-lock.yaml, it automatically selects node as the runtime.

  • In the absence of the lock files mentioned above, if a bun.lockb file is present, Dagger will choose bun as the runtime.

  • If no or only unknown lock files are present, node is chosen.

warning

This behavior however should be seen as a sensible fallback and not as an explicit configuration.