Skip to content

Update Node.js requirement and refactor middleware setup#810

Merged
jamespepper81 merged 2 commits into
devfrom
claude/analyzer-build-warnings-2bmrbr
Jun 28, 2026
Merged

Update Node.js requirement and refactor middleware setup#810
jamespepper81 merged 2 commits into
devfrom
claude/analyzer-build-warnings-2bmrbr

Conversation

@jamespepper81

Copy link
Copy Markdown
Contributor

Summary

This PR makes three key changes to improve project configuration and code organization:

  1. Node.js Version Requirement: Updated engines.node from >=20.19.0 to 22.x to standardize on Node.js 22
  2. Removed Static Asset Caching Header: Deleted the /_next/static/(.*) header rule from next.config.ts that was setting immutable cache headers, allowing Next.js to handle static asset caching automatically
  3. Renamed Middleware Function: Renamed the exported middleware function to proxy in src/proxy.ts to better reflect its purpose as a proxy handler rather than Next.js middleware

Type of Change

  • Bug fix
  • Refactor / cleanup
  • New feature
  • Breaking change
  • Documentation update

Test Plan

  • Verify npm run typecheck passes with the renamed function
  • Confirm npm run lint passes
  • Existing tests should continue to pass as the function logic remains unchanged

Checklist

  • npm run typecheck passes
  • npm run lint passes
  • npm run test passes
  • Documentation updated (if applicable)

https://claude.ai/code/session_01H9xT1uB6VdMvgiG8mByk38

- Pin engines.node to "22.x" instead of open-ended ">=20.19.0" so the
  production Node major no longer auto-upgrades on new releases
- Remove redundant custom Cache-Control header on /_next/static/(.*);
  Next.js already sets immutable caching for its own build output
- Rename middleware file convention to proxy (Next.js 16): src/middleware.ts
  -> src/proxy.ts and export function middleware -> proxy

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H9xT1uB6VdMvgiG8mByk38
@jamespepper81

Copy link
Copy Markdown
Contributor Author

@claude can you code review the pr 810 and make any changes required

Copy link
Copy Markdown
Contributor Author

Code review — looks good ✅

I reviewed the full diff. The PR cleanly addresses all 4 Vercel build warnings, and the changes are correct and minimal:

  1. engines: "22.x" (package.json + lock) — replaces the open-ended >=20.19.0 so the production Node major no longer silently auto-upgrades. 22.x is the current LTS and fully supported by Next.js 16.
  2. Removed redundant /_next/static/(.*) Cache-Control block (next.config.ts) — Next.js already sets immutable caching on its own build output, so the custom rule was both redundant and the source of the warning. The separate /static/(.*) rule for the custom public path is intentionally kept.
  3. middleware.tsproxy.ts + middleware()proxy() — matches the Next.js 16 file-convention migration (docs). The config.matcher export and all bot-blocking logic are unchanged.

Change made during review

The renamed proxy.ts still had doc comments referring to "middleware", which was now inaccurate. I updated that wording for consistency (comments only — no behavior change). Pushed as 8371526.

Verification

  • npm run build — no longer emits the Cache-Control or middleware-deprecation warnings; route table still shows ƒ Proxy (Middleware), confirming the proxy is wired up.
  • npm run typecheck — passes clean.
  • Bot-blocking 403 path and X-Robots-Tag headers are byte-for-byte unchanged.

No further changes required from my side. CI was still running when I last checked — I'll keep watching and flag anything that fails.


Generated by Claude Code

@jamespepper81 jamespepper81 merged commit 9a356fe into dev Jun 28, 2026
5 checks passed
@jamespepper81 jamespepper81 deleted the claude/analyzer-build-warnings-2bmrbr branch June 28, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants