How to make component imports work? #2495
-
Hi, I am using async await evaluate(content, {
...(runtime as any),
Fragment: runtime.Fragment,
useMDXComponents,
baseUrl: import.meta.url
}) Does anyone know why it is like that? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Welcome @ImExoOdeex! |
Beta Was this translation helpful? Give feedback.
-
It is like that for the same reason that if you write |
Beta Was this translation helpful? Give feedback.
Welcome @ImExoOdeex!
When evaluate is run it is running ESM in the browser.
You may need an import map to let it know how to resolve react and any other runtime modules https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap