Nitro · Migration

NITRO0017Replace H3 v2 useBase

H3 v2 renamed useBase() to withBase().

Why it happens

H3 v2 documents withBase() as the handler wrapper for mounting an application under a path prefix, while useBase() remains a legacy alias.

Fix

Import withBase and replace useBase(base, handler) with withBase(base, handler).

Example

Use the H3 v2 path-prefix wrapper

Before

const handler = useBase("/api", app.handler)

After

const handler = withBase("/api", app.handler)

Verify the fix

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

pnpm vite-doctor . --framework nitro --rules nitro/h3/prefer-with-base
Copyright © 2026