---
title: workflowPlugin
description: Configure Vite to transform workflow directives in SvelteKit.
docs_index: /llms.txt
lastUpdated: 2026-10-21
type: reference
summary: Add workflowPlugin to your Vite config to enable workflow directive transformation in SvelteKit apps.
prerequisites:
  - /docs/getting-started/sveltekit
---

> 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 build the workflow bundles in a SvelteKit app.

## Usage

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

```typescript title="vite.config.ts" lineNumbers
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import { workflowPlugin } from "workflow/sveltekit"; // [!code highlight]

export default defineConfig({
  plugins: [sveltekit(), workflowPlugin()], // [!code highlight]
});
```

## API signature

### Parameters

| Parameter | Type                    | Description                              |
| --------- | ----------------------- | ---------------------------------------- |
| `options` | `WorkflowPluginOptions` | Optional. Configures the workflow build. |

#### WorkflowPluginOptions

| Option      | Type                                                      | Default                           | Description                                                                                                                                                                                                                                                                                                                                                                        |
| ----------- | --------------------------------------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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)