next.js
2d3d53f8 - Add codemod command to middleware deprecation warning (#92532)

Commit
162 days ago
Add codemod command to middleware deprecation warning (#92532) ## What Adds the `npx @next/codemod@latest middleware-to-proxy .` command to the middleware deprecation warning in both `next build` and `next dev`. ## Why The existing deprecation warning tells developers to use `proxy` instead of `middleware`, but does not surface the available codemod for automatic migration. Developers have to click through to the docs page to discover it. Including the command directly in the warning lets them copy-paste a one-liner to migrate immediately. ## How Updated the `Log.warnOnce()` call in both: - `packages/next/src/build/index.ts` (build path) - `packages/next/src/server/lib/router-utils/setup-dev-bundler.ts` (dev server path) The warning now reads: ``` The "middleware" file convention is deprecated. Please use "proxy" instead. To migrate automatically, run: npx @next/codemod@latest middleware-to-proxy . Learn more: https://nextjs.org/docs/messages/middleware-to-proxy ``` This follows the same pattern used by other Next.js codemod suggestions (e.g., `next/link` in `link.tsx`). <!-- NEXT_JS_LLM_PR -->
Author
Parents
Loading