workflow

Returns the Vite plugins that transform workflow code ("use step"/"use workflow" directives) and configure the workflow/nitro module on the Nitro server. It is designed to be used alongside nitro() from nitro/vite, which provides the server framework for API routes and deployment.

Usage

To enable "use step" and "use workflow" directives while developing locally or deploying to production, add workflow() to the plugins array of your Vite config, together with nitro().

vite.config.ts
import { nitro } from "nitro/vite";
import { defineConfig } from "vite";
import { workflow } from "workflow/vite";

export default defineConfig({
  plugins: [nitro(), workflow()],
  nitro: {
    serverDir: "./",
  },
});

API signature

Parameters

ParameterTypeDescription
optionsModuleOptionsOptional. Forwarded to the workflow/nitro module as its module options.

ModuleOptions

OptionTypeDefaultDescription
dirsstring[]—Directories to scan for workflows and steps. By default, the workflows/ directory is scanned from the project root and all layer source directories.
typescriptPluginbooleanfalseAdds the workflow TypeScript plugin to the generated tsconfig.json for integrated development environment (IDE) IntelliSense.
runtimestring—Node.js runtime version for Vercel Functions (for example, 'nodejs22.x' or 'nodejs24.x'). Only applies when deploying to Vercel.
sourcemapboolean | 'inline' | 'linked' | 'external' | 'both''inline' (dev) / false (prod)Controls source maps on generated workflow bundles. Accepts the same values as esbuild's sourcemap option. Defaults to 'inline' in development and false in production (smaller function bundles, which helps stay under the Vercel 250 MB function size limit). Set it explicitly, or use the WORKFLOW_SOURCEMAP environment variable, to override in either environment.

Returns

Returns an array of Vite Plugin objects. Spread or pass the array directly to the plugins option of your Vite config. Vite flattens nested plugin arrays automatically.