How to evaluate the output of an esbuild build? #1857
-
I have created this example from the docs. When I build the project, I get a JS file that looks like this: import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import Readme from "https://raw.githubusercontent.com/mdx-js/mdx/main/readme.md";
function MDXContent(props = {}) {
const { wrapper: MDXLayout } = props.components || {};
return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {
children: _jsx(_createMdxContent, {})
})) : _createMdxContent();
function _createMdxContent() {
const _components = Object.assign({
p: "p"
}, props.components);
return _jsxs(_Fragment, {
children: [_jsx(_components.p, {
children: "Here\u2019s the readme:"
}), "\n", _jsx(Readme, {})]
});
}
}
var invoice_mdx_default = MDXContent;
export {
invoice_mdx_default as default
}; To quote the docs (emphasis mine):
How can I evaluate Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The output is a react component. You can render it server side with renderToString (https://reactjs.org/docs/react-dom-server.html#rendertostring) or your preferred server side framework. |
Beta Was this translation helpful? Give feedback.
The output is a react component.
You can render it server side with renderToString (https://reactjs.org/docs/react-dom-server.html#rendertostring) or your preferred server side framework.
Or import it and use it as you would any other component client side.