Builder that compiles workflow files into bundles for NestJS apps.
Builder that scans a NestJS project for workflow files and compiles them into the step, workflow, and webhook bundles plus a manifest. WorkflowModule.forRoot() creates and runs one automatically on startup — instantiate it yourself only when you need to build bundles outside the module lifecycle (e.g. a custom build script for production with skipBuild).
import { NestLocalBuilder } from "workflow/nest";
const builder = new NestLocalBuilder({
dirs: ["src"],
});
await builder.build();
console.log(`Workflow bundles written to ${builder.outDir}`);Constructor
new NestLocalBuilder(options?) creates a builder for the given options.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | NestBuilderOptions | Optional. Configures the workflow build. |
NestBuilderOptions
| Option | Type | Default | Description |
|---|---|---|---|
workingDir | string | process.cwd() | Working directory for the NestJS application. |
dirs | string[] | ['src'] | Directories to scan for workflow files. |
outDir | string | '.nestjs/workflow' (relative to workingDir) | Output directory for generated workflow bundles. |
watch | boolean | false | Enable watch mode for development. |
moduleType | 'es6' | 'commonjs' | 'es6' | SWC module compilation type. When 'commonjs', the builder rewrites externalized imports in the steps bundle to use require() via createRequire, avoiding ESM/CJS named-export interop issues with SWC's output. |
distDir | string | 'dist' | Directory where NestJS compiles .ts source files to .js (relative to workingDir). Used when moduleType is 'commonjs' to resolve compiled file paths. Should match the outDir in your tsconfig.json. |
Methods
build()
Builds the workflow bundles. Writes steps.mjs, workflows.mjs, webhook.mjs, and manifest.json to the output directory (plus a .gitignore covering the generated files when not deploying to Vercel). Returns Promise<void>.
Properties
outDir
Read-only getter that returns the output directory for generated workflow bundles — the outDir option as passed, or the default .nestjs/workflow resolved against workingDir.
Returns
The constructor returns a NestLocalBuilder instance.








