@next/mdx - import()
breaks .mdx files in development
#77554
Labels
Markdown (MDX)
Related to Markdown with Next.js.
import()
breaks .mdx files in development
#77554
Link to the code that reproduces this issue
https://github.com/fullyherge/next-mdx-import-repro/blob/main/src/app/page.tsx
To Reproduce
npm run dev
)Changing to
import Stuff from "stuff.mdx"
works fine, but my use case in existing application that I just updated to Next 15 and React 19 is to import all .mdx files from a certain folder, viarequire.context
.It works fine in production builds.
Current vs. Expected behavior
Importing .mdx file via
import()
gives an error.Expected behaviour is for it to work, like
import x from
does.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_T6020 Available memory (MB): 16384 Available CPU cores: 10 Binaries: Node: 20.18.2 npm: 11.1.0 Yarn: 1.22.22 pnpm: N/A Relevant Packages: next: 15.2.4 // Latest available version is detected (15.2.4). eslint-config-next: 15.2.4 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)
Markdown (MDX)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: