-
Hello. My goal is to try to create an integration for SolidJS users. The issue here is that SolidJS is a JSX compiler, not a runtime - and it can't create components from text tags, so using this sample
the compiled output would be
and it doesn't work for the compiler because components.h2 is a string - it expects a function, or a plain template string which it can parse. The workaround I first applied here is that I've first just removed _components. with a regex before passing the mdx compiled output to babel, and that's enough for solid compiler to understand templates. A second attempt, which also worked, is that I've changed how opening and closing nodes are created directly in forked mdx code to get the same effect. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I would strongly recommend that, assuming solid has components and a vdom or actual dom, to implement an automatic jsx runtime rather than hacking around everything. Here's a svelte example: https://github.com/kenoxa/svelte-jsx/blob/main/src/jsx-runtime.js. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the prompt response - there's no vdom, just actual dom in solid, and there's a small runtime, but only for reactivity. I'm not sure if that's an option.,, If I implemented something like that, all reactivity in components would be lost. The components are basically compiled to plain DOM - they disappear, and only the reactive properties update their dependency graph. |
Beta Was this translation helpful? Give feedback.
I would strongly recommend that, assuming solid has components and a vdom or actual dom, to implement an automatic jsx runtime rather than hacking around everything. Here's a svelte example: https://github.com/kenoxa/svelte-jsx/blob/main/src/jsx-runtime.js.