Skip to content

feat(next-drupal): add Next.js 16 support via peerDependencies - #930

Merged
robdecker merged 1 commit into
mainfrom
feat/next-16-peer-deps
Sep 22, 2026
Merged

robdecker merged 1 commit into
mainfrom
feat/next-16-peer-deps

Conversation

@robdecker

@robdecker robdecker commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

This pull request is for: (mark with an "x")

  • examples/*
  • modules/next
  • packages/next-drupal
  • starters/basic-starter
  • starters/graphql-starter
  • starters/pages-starter
  • Other

GitHub Issue: #884

  • I need help adding tests. (mark with an "x")

Describe your changes

Adds Next.js 16 support without breaking Next 14 or 15.

The problem

next was a regular dependency ranged ^14.2.21 || ^15.1.2, with no peerDependencies at all. Next 16 fell outside that range, so package managers installed a second copy of Next inside next-drupal and consumers got two NextURL types. NextURL carries a private [Internal] member typed as a unique symbol, so two installs produce two incompatible types even though the declaration files are byte identical. Hence #884:

Types of property 'nextUrl' are incompatible.

The change

Move next, react and react-dom to peerDependencies and add ^16.0.0 to the next range. They are also added to devDependencies so tsup and jest still resolve next/* in the workspace.

Not a breaking change, should release as 2.1.0. The peer range is a strict superset of the old dependency range, so every currently valid install stays valid. Consumers who never declared next themselves now have to, which is normal for a Next library and matches next-auth.

Verified

Against a Next 16.3.1 app consuming a packed build of this branch: one copy of Next instead of two, and tsc --noEmit under strict clean where published 2.0.1 fails. Typechecking the source against next 16.3.1 and 15.1.2 gives identical error lists, so Next 16 adds no new errors.

In the monorepo: install, tsup build and DTS build clean; yarn workspace next-drupal test gives 163 passed across 10 suites. The full suite was not run: the integration files need a live Drupal, so only the pull_request subset ran.

Known gaps

  • No Next 16 leg in CI: the workflow pins Node 18.19.x and Next 16 needs Node >= 20.9, so nothing here is proven by CI.

  • The Pages Router *FromContext helpers are typechecked but not runtime tested on 16, as raised in NextJS 16 #884.

  • Was AI used in this pull request?

@vercel

vercel Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
next-drupal-next Ready Ready Preview Sep 22, 2026 12:00am UTC
2 Skipped Deployments
Project Deployment Actions Updated
next-drupal Ignored Ignored Sep 22, 2026 12:00am UTC
next-drupal-v1-6 Ignored Ignored Sep 22, 2026 12:00am UTC

Request Review

Next 16 fell outside the declared `next` range, so package managers installed a
second copy of Next inside next-drupal. That gave consumers two NextURL types.
NextURL carries a `private [Internal]` member typed as a `unique symbol`, and two
installs declare two distinct symbols, so the types are nominally incompatible
even when the declaration files are byte identical. Passing a NextRequest to
enableDraftMode failed with "Types of property 'nextUrl' are incompatible".

Move next, react and react-dom to peerDependencies and add ^16.0.0 to the next
range. The peer range is a superset of the old dependency range, so every
currently valid install stays valid. Consumers who did not already depend on
next now have to declare it, which is the normal arrangement for a Next library.

react-dom is imported nowhere in the package and react only by the deprecated
useMenu hook, but both stay declared as peers to match what Next itself requires.

Closes #884
@robdecker
robdecker force-pushed the feat/next-16-peer-deps branch from 970d04a to 404890a Compare September 22, 2026 00:00
@robdecker
robdecker merged commit e56c636 into main Sep 22, 2026
12 of 13 checks passed
@robdecker
robdecker deleted the feat/next-16-peer-deps branch September 22, 2026 17:15

This branch had an error being deployed

1 failed (outdated) and 1 active deployments
Preview – next-drupal-next — 404890a8 Deployed Sep 22, 2026 by vercel[bot]
Preview — 970d04a6 Deployed Sep 21, 2026 by robdecker via next-drupal #966
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