Skip to content

How to run compiled MDX without calling the Function constructor? #2322

Discussion options

You must be logged in to vote

I managed to get a working pipeline of unified + remark + rehype + rehype react to work just fine.

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.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@CapitaineToinon
Comment options

@ChristianMurphy
Comment options

Answer selected by CapitaineToinon
@wooorm
Comment options

@CapitaineToinon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants