H3 · H30019

Replace 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.
H30019vite-doctor/h3migrationerrorSuggestion

Run this rule

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

Why it matters

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.

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)
Copyright © 2026