UNPKG

workflow

Version:

Workflow SDK - Build durable, resilient, and observable workflows

49 lines (37 loc) • 2.08 kB
--- title: "workflow/nuxt" description: Nuxt module for automatic workflow bundling and runtime configuration. type: overview summary: Explore the Nuxt module that enables workflow directive transformation in Nuxt apps. related: - /docs/getting-started/nuxt --- Nuxt integration for Workflow SDK. The `workflow/nuxt` entry point's default export is a Nuxt module: it has no callable API. You enable it by adding it to the `modules` array of your Nuxt config and configure it via the `workflow` key. ## Usage ```typescript title="nuxt.config.ts" lineNumbers import { defineNuxtConfig } from "nuxt/config"; export default defineNuxtConfig({ modules: ["workflow/nuxt"], // [!code highlight] compatibilityDate: "latest", }); ``` When enabled, the module: - Registers the [`workflow/nitro`](/docs/api-reference/workflow-nitro) module on Nuxt's Nitro server, which transforms `"use workflow"` and `"use step"` directives, builds the workflow bundles, and registers the workflow runtime routes under `/.well-known/workflow/v1/`. - Configures Vite to bundle (rather than externalize) the Workflow SDK packages in server-side rendering (SSR) mode so workflow code is transformed correctly. - Enables the `workflow` TypeScript plugin by default for integrated development environment (IDE) IntelliSense. - Uses Nuxt/Nitro's detected `workspaceDir` so monorepo apps can import sibling workspace packages without extra workflow config. ## Module options Options are read from the `workflow` key of your Nuxt config. The option type is exported as `ModuleOptions`: ```typescript title="nuxt.config.ts" lineNumbers import { defineNuxtConfig } from "nuxt/config"; export default defineNuxtConfig({ modules: ["workflow/nuxt"], workflow: { typescriptPlugin: false, // [!code highlight] }, compatibilityDate: "latest", }); ``` | Option | Type | Default | Description | | --- | --- | --- | --- | | `typescriptPlugin` | `boolean` | `true` | Adds the `workflow` TypeScript plugin to the generated `tsconfig.json` for IDE IntelliSense. Set to `false` to disable it. |