H3 · Migration

H30019Replace router APIs H3 v2 removed

Flags router.add(), router.resolve(), app.stack, lazy handlers registered with { lazy: true }, and array route paths, which H3 v2 removed.

Why it happens

H3 v2 merged the router into the app. The removed members are undefined at runtime, so a call throws when the route module loads and the server fails to start.

Fix

Register routes with app.on(method, path, handler) or app.get(path, handler), register each path separately, and wrap lazy handlers with defineLazyEventHandler().

Example

Register routes on the app

Before

const router = createRouter()
router.add("/items", listItems)
app.use(router)

After

app.get("/items", listItems)

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm vite-doctor . --rules h3/migration/no-removed-router-api
Copyright © 2026