workflow
Version:
Workflow SDK - Build durable, resilient, and observable workflows
46 lines (32 loc) • 1.92 kB
text/mdx
title: workflow
description: Configure Astro to transform workflow directives.
type: reference
summary: Add the workflow integration to your Astro config to enable workflow directive transformation.
prerequisites:
- /docs/getting-started/astro
Returns an Astro integration that transforms workflow code (`"use step"`/`"use workflow"` directives) and builds the workflow bundles.
## Usage
To enable `"use step"` and `"use workflow"` directives while developing locally or deploying to production, add `workflow()` to the `integrations` array of your Astro config.
```typescript title="astro.config.mjs" lineNumbers
// @ts-check
import { defineConfig } from "astro/config";
import { workflow } from "workflow/astro"; // [!code highlight]
// https://astro.build/config
export default defineConfig({
integrations: [workflow()], // [!code highlight]
});
```
The integration registers the workflow Vite transform plugins during `astro:config:setup` and builds the workflow bundles — locally during config setup, or via the Vercel builder after `astro:build:done` when deploying to Vercel.
## 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'` | Controls source maps on generated workflow bundles. Accepts the same values as esbuild's `sourcemap` option. Set to `false` for smaller function bundles (useful for staying under the Vercel 250MB function size limit) at the cost of stack traces pointing at generated code. Can also be set via the `WORKFLOW_SOURCEMAP` environment variable. |
### Returns
Returns an `AstroIntegration` object to include in the `integrations` array of your Astro config.