middleware.ts in Next.js 16
Why it matters
Next.js 16 renamed middleware to proxy (Node.js runtime); middleware is deprecated.
Fix
Rename middleware.ts to proxy.ts and the exported function to proxy (the codemod does both).
Credit
From the Next.js team
Renamed middleware to proxy in Next.js 16 and ships a codemod for the migration.
References
- proxy.jsNext.js
- How to upgrade to version 16Next.js
- CodemodsNext.js
- Next.js 16Next.js