---
title: workflow
description: Configure Vite and Nitro to transform workflow directives.
docs_index: /llms.txt
lastUpdated: 2026-10-21
type: reference
summary: Add the workflow plugin to your Vite config to enable workflow directive transformation in Vite + Nitro apps.
prerequisites:
  - /docs/getting-started/vite
---

> For an index of all documentation, see [/llms.txt](/llms.txt).

Returns the Vite plugins that transform workflow code (`"use step"`/`"use workflow"` directives) and configure the [`workflow/nitro`](/docs/api-reference/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()`.

```typescript title="vite.config.ts" lineNumbers
import { nitro } from "nitro/vite";
import { defineConfig } from "vite";
import { workflow } from "workflow/vite"; // [!code highlight]

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

## API signature

### Parameters

| Parameter | Type            | Description                                                               |
| --------- | --------------- | ------------------------------------------------------------------------- |
| `options` | `ModuleOptions` | Optional. Forwarded to the `workflow/nitro` module as its module options. |

#### ModuleOptions

| Option             | Type                                                      | Default                           | Description                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------ | --------------------------------------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dirs`             | `string[]`                                                | —                                 | Directories to scan for workflows and steps. By default, the `workflows/` directory is scanned from the project root and all layer source directories.                                                                                                                                                                                                                             |
| `typescriptPlugin` | `boolean`                                                 | `false`                           | Adds the `workflow` TypeScript plugin to the generated `tsconfig.json` for integrated development environment (IDE) IntelliSense.                                                                                                                                                                                                                                                  |
| `runtime`          | `string`                                                  | —                                 | Node.js runtime version for Vercel Functions (for example, `'nodejs22.x'` or `'nodejs24.x'`). Only applies when deploying to Vercel.                                                                                                                                                                                                                                               |
| `sourcemap`        | `boolean \| '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.

---

For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md)

For an index of all available documentation, see [/llms.txt](/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/agents.md](/agents.md)