Skip to content

[Vite + Nitro] Workflow HMR not working — file changes not picked up in dev and slow rebuilding #2350

@Yanick64

Description

@Yanick64

[Vite + Nitro] Workflow HMR not working — file changes not picked up in dev and slow rebuilding

Environment

Package Version
workflow 4.4.0
@workflow/nitro 4.1.0
@workflow/vite 4.0.9
@workflow/builders 4.0.10
nitro 3.0.260610-beta
vite 8.0.16
Node 24.15.0
OS macOS (darwin)

Bug description

When using the recommended Vite + Nitro setup per the docs, editing a workflow file (containing "use workflow" / "use step" directives) does not trigger a rebuild of the workflow bundles. The dev server continues serving the stale version. Only a full restart picks up changes. Regular API route HMR (non-workflow files) works fine via Nitro's Vite environment.

Also the terminal says it is rebuilding (which takes around 8000 ms) and succeed, but still a console.log stays the same (old value) within a step for example.

Steps to reproduce

  1. Set up a Vite + Nitro project per the docs:
// vite.config.ts
import { nitro } from "nitro/vite";
import { defineConfig } from "vite";
import { workflow } from "workflow/vite";
export default defineConfig({
  plugins: [
    nitro({
      serverDir: "./src",
    }),
    workflow({ dirs: ["./src/workflows"] }),
  ],
  resolve: { tsconfigPaths: true },
});
  1. Create a workflow file with "use workflow" and "use step" directives
  2. Run vite (dev server)
  3. Edit the workflow file (e.g. add a console.log inside a step)
  4. Trigger the workflow — the old version still runs

Summary

We have two problems, HMR is not working and rebuilding is very slow. I am not sure how to rexolve those and can't find any other tickets about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions