How to run compiled MDX without calling the Function constructor? #2322
Answered
by
ChristianMurphy
CapitaineToinon
asked this question in
Q&A
-
Hello there! I've been trying to use mdx with nextjs hosted on the edge. Unfortunately, it happens that on the edge, But running Is there an otherway to get mdx in react without those apis? |
Beta Was this translation helpful? Give feedback.
Answered by
ChristianMurphy
Jul 7, 2023
Replies: 1 comment 4 replies
-
Yes, MDX generates JavaScript. Something needs to run that JavaScript. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rehype produces HTML, which doesn't run, and is purely rendered in browser.
MDX produces JavaScript, it can be run either on the browser or the server, when it is run it produces HTML.
If you want to run it on the server, you need a way to dynamically run JavaScript, like:
eval
,new Function
, or a dynamic import.