mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #224] [MERGED] fix: Add next/compat/router shim #403
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#403
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/224
Author: @wobsoriano
Created: 3/2/2026
Status: ✅ Merged
Merged: 3/3/2026
Merged by: @southpolesteve
Base:
main← Head:rob/esm-router-compat📝 Commits (3)
500f55dfeat: Add next/compat/router shimd71c87bchore: update docc2a53d6Apply suggestion from @ask-bonk[bot]📊 Changes
3 files changed (+36 additions, -0 deletions)
View changed files
📝
packages/vinext/src/index.ts(+1 -0)➕
packages/vinext/src/shims/compat-router.ts(+23 -0)📝
tests/shims.test.ts(+12 -0)📄 Description
Adds a new
compat-routershim fornext/compat/router, the public Next.js API intended for components shared between Pages Router and App Router.@clerk/nextjs(ref) import fromnext/compat/router. Thenext/compat/routerpackage entry is CJS (module.exports = require(...)), which Vite cannot extract named ESM exports from — causing a "does not provide an export named 'useRouter'" error at runtime. Adding a native ESM shim in vinext resolves this without requiring apps to add aresolve.aliasworkaround.Temporary fix:
Locally tested via
pnpm link🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.