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

evaling code breaks if code contains import statements with sources that should be resolved by the bundler #9

Open
eps1lon opened this issue Feb 25, 2025 · 0 comments

Comments

@eps1lon
Copy link

eps1lon commented Feb 25, 2025

This is based off of vercel/next.js#76395

The concrete case used React.createElement instead of just JSX to construct elements. However, the same issue occurs if any other React is being used.

Next.js applies aliases to certain import sources. However, this does not apply to code dynamically evaluated like eval or Reflect.construct. Since next-mdx-remote-clientuses Reflect.construct to run code, imports to React will resolve to the wrong version of React. In this case it's the installed, Client React. Mixing different versions of React or Server and Client React in the same component is not supported.

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

1 participant