Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to compile error #436

Open
haroonchoudery opened this issue Feb 23, 2024 · 8 comments
Open

Failed to compile error #436

haroonchoudery opened this issue Feb 23, 2024 · 8 comments

Comments

@haroonchoudery
Copy link

I'm getting the following error:

 ./node_modules/next-mdx-remote/rsc.js 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.

I'm a noob so totally clueless what's happening here. My repo (https://github.com/haroonchoudery/haroonai) is a fork of @leerob 's

@nekochan0122
Copy link

nekochan0122 commented Mar 1, 2024

Same issues here when I using Turbopack in Next.js 14.1.1

@talatkuyuk
Copy link

talatkuyuk commented Mar 1, 2024

I cloned your repo, tried below in the next.config.mjs:

experimental: {
  serverComponentsExternalPackages: ['next-mdx-remote']
}

but it didn't work.

For a temporary solution you can use next-mdx-remote-client and make a change in the app/components/mdx.tsx as import { MDXRemote } from "next-mdx-remote-client/rsc"; I tested it it works.

After the next-mdx-remote is fixed some time later, you can continue to use next-mdx-remote.

@nirtamir2
Copy link

Same issue with Next.js 14.2 + turbopack

@bcigdemoglu
Copy link

Same here on "next": "^14.2.1-canary.6"

@dstaley
Copy link
Contributor

dstaley commented Apr 15, 2024

@nirtamir2 @bcigdemoglu can you try with [email protected] and let me know if you're still experiencing this issue?

@james-william-r
Copy link

[email protected]

no luck, still getting the same error on my end

@vasyaqwe
Copy link

@nirtamir2 @bcigdemoglu can you try with [email protected] and let me know if you're still experiencing this issue?

thank you, this resolved the issue for me. i'm on next 14.2.2, no turbopack

@dstaley
Copy link
Contributor

dstaley commented Apr 19, 2024

If you're using Turbopack, you'll need to add next-mdx-remote to transpilePackages in your next.config.js due to this Next.js bug with ESM-only packages.

transpilePackages: ['next-mdx-remote'],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants