Closed deadcoder0904 closed 3 years ago
Oopsie while making a repro, I again got this error:
'MDXProvider' refers to a value, but is being used as a type here. Did you mean 'typeof MDXProvider'?ts(2749)
This error is weird but as this file was small, I noticed the extension I had was .ts
but I was using JSX in the mdx
function.
So changed the extension to .tsx
& it worked. Was stuck on this weird problem for like 2-3 weeks.
Where does MDXProvider and MDXLayoutRenderer come from? It appears that this is neither exported by mdx-bundler
nor mdx-bundler/client
:/
MDXLayoutRenderer
Nvm. I just saw that MDXLayoutRenderer is a custom component you created 😀
I want to convert
code
returned bybundleMDX
tostring
for RSS reader I'm writing so I can use it withReactDOMServer.renderToStaticMarkup(mdx)
like:https://github.com/tailwindlabs/blog.tailwindcss.com/blob/acb8dcfbc733e25c0e1f4e8af5323da421071cbc/scripts/build-rss.js#L36
The Tailwind Blog above uses
next-mdx-remote
where it works but I'm not sure how to do the similar thing inmdx-bundler
.I've tried wrapping
code
inMDXLayoutRenderer
usingmdxSource
:But this throws weird TS errors like:
If I make
mdx
a function & return the value from it, then also it doesn't work:All I need is to pass a
html
formatted string so that I can send it to RSS packagefeed
.My example is exactly similar to the Tailwind Blog with 1 difference: I'm using
mdx-bundler
instead ofnext-mdx-remote
How can I solve this problem?