Skip to content

Any way to not evaluate components that are not defined? #2343

Answered by wooorm
leo-petrucci asked this question in Q&A
Discussion options

You must be logged in to vote

This is being compiled on the fly in an editor on the client (DecapCMS) which allows editing of Markdown and MDX files.

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}.

When ran through the evaluate function on the client, it fails because it cannot import the component.

The client side can handle import. The whole reason ESM exists is so that it can all work on the client.

Is there any way to tell the evaluate function to not attempt to compile components that aren't passed to it or part of the context?

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@leo-petrucci
Comment options

Comment options

You must be logged in to vote
5 replies
@leo-petrucci
Comment options

@wooorm
Comment options

@leo-petrucci
Comment options

@wooorm
Comment options

@ChristianMurphy
Comment options

Answer selected by ChristianMurphy
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