Refactor import statements and error handling in CMS renderers

The commit updates the way 'Markdoc' is imported in the Keystatic content renderer. It also introduces type checks for imports in the core renderer package. For better error handling, a console.error message has been added for unknown CMS client types.
This commit is contained in:
giancarlo
2024-05-07 19:19:45 +07:00
parent dd99e47e70
commit ce993ad120
2 changed files with 19 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
import * as React from 'react';
import Markdoc from '@markdoc/markdoc';
const Markdoc = await import('@markdoc/markdoc');
export function KeystaticDocumentRenderer({ content }: { content: unknown }) {
return Markdoc.renderers.react(content as string, React);