[GH-ISSUE #521] Missing .js alias variants for next/config and next/amp #110

Closed
opened 2026-05-06 12:37:18 +02:00 by BreizhHardware · 0 comments

Originally created by @NathanDrake2406 on GitHub (Mar 13, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/521

Problem

The shim alias map in the Vite plugin registers next/config and next/amp but not their .js extension variants (next/config.js, next/amp.js).

Every other public next/* entrypoint has both variants (e.g., next/navigation + next/navigation.js). These .js variants are required because some libraries — like nuqs — import Next.js modules with the explicit .js extension. Without the alias, Vite resolves to the real next package instead of vinext's shim, causing build failures or runtime errors.

Expected behavior

import "next/config.js" and import "next/amp.js" should resolve to the vinext shims, just like import "next/config" and import "next/amp" do.

Fix

Add the two missing .js alias entries to the shim map in index.ts.

Originally created by @NathanDrake2406 on GitHub (Mar 13, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/521 ## Problem The shim alias map in the Vite plugin registers `next/config` and `next/amp` but not their `.js` extension variants (`next/config.js`, `next/amp.js`). Every other public `next/*` entrypoint has both variants (e.g., `next/navigation` + `next/navigation.js`). These `.js` variants are required because some libraries — like `nuqs` — import Next.js modules with the explicit `.js` extension. Without the alias, Vite resolves to the real `next` package instead of vinext's shim, causing build failures or runtime errors. ## Expected behavior `import "next/config.js"` and `import "next/amp.js"` should resolve to the vinext shims, just like `import "next/config"` and `import "next/amp"` do. ## Fix Add the two missing `.js` alias entries to the shim map in `index.ts`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#110
No description provided.