-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat: add support for server islands for MDX
#12446
Conversation
|
Thanks for starting on this! |
@@ -30,7 +30,7 @@ export const rehypeAnalyzeAstroMetadata: RehypePlugin = () => { | |||
if (node.type !== 'mdxJsxFlowElement' && node.type !== 'mdxJsxTextElement') return; | |||
|
|||
const tagName = node.name; | |||
if (!tagName || !isComponent(tagName) || !hasClientDirective(node)) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could removing this condition be why tests are failing? should you instead change the condition to also account for hasServerDeferDirective
but otherwise leave in the hasClientDirective check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing this. Sure I will include hasServerDeferDirective
in the existing condition.
@ematipico I noticed you have closed tuis PR. What's the plan to fix this issue? |
|
Sure, I will do that. |
Reopened for |
Changes
Closes #12252
Server Islands are not rendering as islands in .mdx files because server islands metadata is not added for JSX components in MDX files.
Even after adding server islands metadata, the issue persists because transform function in vite-plugin-server-islands.ts file runs before server metadata is added in rehype.ts file.
I found that vite-plugin-server-islands.ts is added last in create-vite.ts and has
enforce: 'post'
but still transform function is running before the server meta data is added.I am looking for feedback and guidance from Astro contributors on how to fix it.
Testing
TODO
Docs
Not needed