workflow
Version:
Workflow SDK - Build durable, resilient, and observable workflows
35 lines (24 loc) • 1.27 kB
text/mdx
title: workflowPlugin
description: Configure Vite to transform workflow directives in SvelteKit.
type: reference
summary: Add workflowPlugin to your Vite config to enable workflow directive transformation in SvelteKit apps.
prerequisites:
- /docs/getting-started/sveltekit
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
This function does not accept any parameters in workflow 4.x. (5.x adds an options object with a `sourcemap` setting.)
### 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.