next.js: Using `--turbo` with `next-mdx-remote/rsc` throws `ModuleBuildError`
Link to the code that reproduces this issue
https://github.com/devjiwonchoi/repro-next-turbo-mdx-remote-rsc
To Reproduce
pnpm ipnpm dev- Open
http://localhost:3000
Current vs. Expected behavior
Current
Package next-mdx-remote (serverComponentsExtenalPackages or default list) can't be external
The request next-mdx-remote/rsc matches serverComponentsExtenalPackages (or the default list), but it can't be external:
The package seems invalid. require() resolves to a EcmaScript module, which would result in an error in Node.js.
Expected
It should not throw
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:32:11 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6030
Available memory (MB): 18432
Available CPU cores: 11
Binaries:
Node: 18.17.0
npm: 9.6.7
Yarn: 1.22.19
pnpm: 8.15.4
Relevant Packages:
next: 14.2.0-canary.23 // Latest available version is detected (14.2.0-canary.23).
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.4.2
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Turbopack (–turbo)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
This issue has been introduced at next@14.1.1-canary.64
Related PR: https://github.com/vercel/next.js/pull/62235
This works when using webpack only (next dev)
About this issue
- Original URL
- State: closed
- Created 4 months ago
- Reactions: 6
- Comments: 16 (9 by maintainers)
Commits related to this issue
- fix: disable --turbo due to issues with remote-mdx-next/rsc Using --turbo with next-mdx-remote/rsc throws ModuleBuildError; https://github.com/vercel/next.js/issues/63318 — committed to grzegorzpokorski/next-shop by grzegorzpokorski 2 months ago
Update: I published remote-mdx, a fork of
next-mdx-remote, and resolved the output.IMHO this is still a bug since webpack can handle this package.
^ Temporary workaround, duplicate issue here (https://github.com/vercel/next.js/issues/64525) which is being worked on (open PR https://github.com/vercel/next.js/pull/64918).
Thank you @devjiwonchoi. Actually using your workaround in the meantime. cc @leerob @jaredpalmer
I get the following error with
remote-mdx: