Any way to not evaluate components that are not defined? #2343
-
I'm using Is there any way to avoid attempting to evaluate these? I was hoping I'd at least be able to catch the missing component error:
But More contextGiven the following MDX:
This is being compiled on the fly in an editor on the client (DecapCMS) which allows editing of Markdown and MDX files. Is there any way to tell the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
a) provide more info |
Beta Was this translation helpful? Give feedback.
-
You can integrate with how things are compiled: you can change
The client side can handle
MDX does not compile your components. But like JavaScript/React/etc: you can’t have undefined variables. Things crash. That’s intentional. |
Beta Was this translation helpful? Give feedback.
You can integrate with how things are compiled: you can change
<X />
into<Y />
with a plugin.You can also pass components for all potential components, assuming they are not defined:
{X: UndefinedComponent, Y: UndefinedComponent}
.The client side can handle
import
. The whole reason ESM exists is so that it can all work on the client.