Plugin registered handlers are not bundled
Environment
Nitro version: 3.1.0-20251028-160624-0b002649
Bun: 1.3.1
Also tried:
Node version: v20.18.2
Reproduction
Build a minimal example from https://github.com/vercel/workflow
Describe the bug
While it is workinf in dev, the output from nitro build doesn't include the code related to handlers registered via a module like here: https://github.com/vercel/workflow/blob/577d2121b826db535343ab04cc64386d9ba5e087/packages/nitro/src/index.ts#L58
Which at the end, in this special case, produce a step not found error like:
(base) ➜ gigi git:(main) ✗ bun run .output/server/index.mjs
...
[embedded world] Failed to queue message {
queueName: "__wkf_step_step//workflows/...,
text: "\"Error: Step \\\"step//workflows/...\\\" not found\"",
status: 500,
headers: {
"content-length": "105",
"content-type": "application/json;charset=utf-8",
date: "Thu, 30 Oct 2025 18:37:08 GMT",
},
...
}
Additional context
No response
Logs
(base) ➜ gigi git:(main) ✗ bun run build
$ bunx --bun vite build
Discovering workflow directives 109ms
Created intermediate workflow bundle 24ms
Created steps bundle 12ms
Creating webhook route
◐ Building [Nitro] (preset: bun, compatibility: 2025-10-30) nitro 7:36:48 PM
✔ Generated public .output/public nitro 7:36:48 PM
vite v7.1.12 building SSR bundle for production...
✓ 506 modules transformed.
.output/server/chunks/routes/.......get.mjs 0.37 kB
.output/server/chunks/routes/......mjs 0.39 kB
.output/server/chunks/routes/support-request/......post.mjs 1.17 kB
.output/server/chunks/routes/support-request/......post.mjs 1.19 kB
.output/server/index.mjs 47.35 kB
✓ built in 2.51s
ℹ Generated .output/nitro.json 7:36:50 PM
✔ You can preview this build using bun run .output/server/index.mjs
Thanks for reporting issue. When building for vercel target, that module actually directly uses build output API with extra functions and skips adding route handlers.
I will investigate self-hosted situation, might be a recent regression from routing optimizations.