Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
External modules not supported in subpath imports | GoodFirstPicks

External modules not supported in subpath imports

vercel/next.js 0 comments 10d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeNext.jsTypeScriptReact

Why this is a good first issue

Subpath imports for external modules are not supported as per Node.js specifications.

AI Summary

The issue involves subpath imports not supporting external modules as specified by Node.js documentation. The problem occurs during development and build stages, affecting module resolution. The fix likely requires changes in how Next.js handles module resolution, particularly for external packages.

Issue Description

Link to the code that reproduces this issue

https://github.com/ysulyma/nextjs-subpath-imports-external-bug

To Reproduce

  1. Start the application in development (next dev)
  2. You will get the error Module not found: Can't resolve '#image'
Image

Current vs. Expected behavior

Node.js docs specify that imports field is allowed to map to external packages: https://nodejs.org/api/packages.html#subpath-imports, however this does not work.

// package.json
{
  // ...
  "imports": {
    "#image": "next/image"
  }
}

// page.tsx
import Image from "#image";

I originally encountered this issue while trying to get MathJax to server-render; they have imports in the above style as you can see from their package.json.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Fri Jul  5 17:56:39 PDT 2024; root:xnu-10063.141.1~2/RELEASE_ARM64_T8122
  Available memory (MB): 24576
  Available CPU cores: 8
Binaries:
  Node: 23.11.1
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 10.25.0
Relevant Packages:
  next: 16.2.0 // Latest available version is detected (16.2.0).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Module Resolution, Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Other (Deployed), Vercel (Deployed)

Additional context

No response

GitHub Labels

TurbopackModule Resolution

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • module resolution
  • external dependencies
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno