close

workflow

Configure Vite and Nitro to transform workflow directives.

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 IDE IntelliSense.
runtimestringNode.js runtime version for Vercel Functions (e.g. 'nodejs22.x', 'nodejs24.x'). Only applies when deploying to Vercel.

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.

On this page

GitHubEdit this page on GitHub