Skip to content

MDX integration will not work with dynamic route import #77456

Open
@CNLHC

Description

@CNLHC

Link to the code that reproduces this issue

https://github.com/CNLHC/next-mdx-dynamic-route-reproduce.git

To Reproduce

  1. git clone https://github.com/CNLHC/next-mdx-dynamic-route-reproduce.git
  2. pnpm i
  3. pnpm next
  4. access http://localhost:3000/content/test

Current vs. Expected behavior

Current this process will cause Module Not Found Error

Image

Expected behavior is render markdown file properly.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6031
  Available memory (MB): 131072
  Available CPU cores: 16
Binaries:
  Node: 23.1.0
  npm: 10.9.0
  Yarn: 1.22.17
  pnpm: 10.6.2
Relevant Packages:
  next: 15.2.3 // Latest available version is detected (15.2.3).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.8.2
Next.js Config:
  output: N/A

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

Dynamic Routes

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

next dev (local)

Additional context

This issue is similar to the #51324

Since import will work if we use static string instead of variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions