Client-only API called on the server side.

There's this one nice library which can bundle MDX as a JSX Component. Thanks to _jsx_runtime it's easy-ish to adapt it from react-only to other JSX supporting libraries. (https://github.com/kentcdodds/mdx-bundler) I've managed to nail it down for some of the libraries, unfortunately I'm stuck with Solid's one, and I'm not that familiar with Solid (https://github.com/kentcdodds/mdx-bundler/pull/236) I've
import * as SolidH from "solid-js/h"; (_jsx_runtime is imported from there?

/** @param {JSX.HTMLAttributes<HTMLSpanElement>} props */
const SpanBold = ({children}) => {
return SolidH.default('span', { class: "strong" }, children)
}

const res = SolidH.default(SpanBold, {children: "hello"});
import * as SolidH from "solid-js/h"; (_jsx_runtime is imported from there?

/** @param {JSX.HTMLAttributes<HTMLSpanElement>} props */
const SpanBold = ({children}) => {
return SolidH.default('span', { class: "strong" }, children)
}

const res = SolidH.default(SpanBold, {children: "hello"});
And I receive
Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.
Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.
From what I manged to figure out about SSR (from outputs), build creates string[] which is then SSR'ed. Basically, behaves quite more different than other JSX libs (preact, react, hono, vue) especially on Server Side?
GitHub
GitHub - kentcdodds/mdx-bundler: 🦤 Give me MDX/TSX strings and I'll...
🦤 Give me MDX/TSX strings and I'll give you back a component you can render. Supports imports! - kentcdodds/mdx-bundler
GitHub
draft: feat(jsx): base for supporting more runtimes by muningis · P...
What: Support JSX runtimes other than react. Why: Allow this to be used with other JSX runtimes supported by mdxjs (https://mdxjs.com/docs/getting-started/#jsx) but not limited to. For example, thi...
2 Replies
brenelz
brenelz3w ago
I think you'll want to use the latest vite-plugin-solid
NaughtyShiba
NaughtyShibaOP3w ago
Ah, so kinda what I thought. Doesn’t fit in that nicely with how it works. Thanks!

Did you find this page helpful?