-
Notifications
You must be signed in to change notification settings - Fork 8
Update Next.js 16 #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Next.js 16 #130
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR upgrades the project to Next.js 16 and React 19, modernizes the dependency stack, and migrates to ESLint's flat configuration format. A new proxy.ts middleware file is introduced to maintain VIP infrastructure compatibility.
Key Changes:
- Upgraded core frameworks: Next.js to 16.0.0, React and React-DOM to 19.2.0, and Apollo Client to 4.0.9
- Migrated ESLint from legacy
.eslintrcto flat config format (eslint.config.mjs) with ESLint 9.0.0 - Added
proxy.tsmiddleware file with VIP-specific header handling and health check routing
Reviewed changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Version bump to 0.2.0; upgraded Next.js, React, TypeScript, ESLint, and testing dependencies; updated lint scripts for flat config |
| proxy.ts | New middleware file handling VIP-specific headers, prefetch header removal, and health check rewrites |
| eslint.config.mjs | New ESLint flat config using FlatCompat for Next.js plugin compatibility |
| next.config.js | Added explicit image optimization defaults for Next.js 16 compatibility with explanatory comments |
| tsconfig.json | Changed jsx compiler from "preserve" to "react-jsx" for React 19 support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
eslint.config.mjs
Outdated
| export default [ | ||
| js.configs.recommended, | ||
| ...compat.extends('next', 'next/core-web-vitals'), | ||
| { | ||
| rules: { | ||
| // Custom rules can be added here | ||
| }, | ||
| }, | ||
| ]; |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new flat config is missing the editorconfig and jest plugins that were configured in the old .eslintrc file. These plugins provided important linting rules (e.g., editorconfig/indent, jest/recommended). Consider adding these plugins to the new config using FlatCompat or ensure the old .eslintrc file is removed to avoid configuration conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
| // Next.js proxy (formerly middleware) | ||
| // =================================== | ||
| // https://nextjs.org/docs/middleware | ||
| // Note: In Next.js 16, middleware.ts has been renamed to proxy.ts |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is incorrect. Next.js 16 did not rename middleware.ts to proxy.ts. The standard middleware convention still uses middleware.ts in Next.js 16. If proxy.ts is being used for VIP-specific infrastructure reasons, the comment should clarify that this is a VIP naming convention, not a Next.js 16 change.
| // Note: In Next.js 16, middleware.ts has been renamed to proxy.ts | |
| // Note: This file is named proxy.ts for VIP-specific infrastructure reasons. | |
| // The standard Next.js convention is still middleware.ts, even in Next.js 16. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@luiztiago I've opened a new pull request, #131, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: luiztiago <199867+luiztiago@users.noreply.github.com>
Remove legacy .eslintrc to resolve ESLint flat config conflicts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
I opened #132 with some fixes to get the skeleton working as right now, if you point it to a WP backend it fails. That can go into this branch |
|
@Automattic/vip-platform-cantina Consider updating this repo with a note saying that it is purely an example, is not maintained, and could harbor future vulnerabilities. Then archive it (with or without this PR). Next.js is a markedly different (worse) framework compared to three years ago (when this repo was developed) and it is much less suitable to our platform. |
Attempt to fix the code for Next 16
This pull request updates the project to support Next.js 16 and React 19, modernizes dependencies, and migrates ESLint configuration to the new flat config format. It also introduces a new
proxy.tsmiddleware file to handle Next.js 16 middleware changes and ensure compatibility with VIP infrastructure.Framework and Dependency Upgrades:
nextto version 16.0.0,reactandreact-domto 19.2.0,@apollo/clientto 4.0.9, and updated related type packages to match new major versions. This ensures compatibility with the latest features and security patches. [1] [2]ESLint Migration and Configuration:
eslint.config.mjsand updating lint scripts inpackage.json. Added new ESLint dependencies (@eslint/eslintrc,@eslint/js) and updated existing ones. [1] [2] [3]Next.js Middleware Update:
proxy.tsto replace the legacymiddleware.ts, adapting to Next.js 16 conventions. This middleware removes thex-middleware-prefetchheader, rewrites healthcheck requests, and sets VIP-specific headers to ensure correct error page handling.Version Bump:
package.jsonfrom0.1.0to0.2.0to reflect significant changes.