alex4o
alex4o2mo ago

Creating custom react components fails with jsxRuntime not defined

I want to create a graph network visualisation app component and was looking at either https://reagraph.dev/ or https://www.xyflow.com/ but both add jsxRuntime as dependency and can't be ran. Is there a way to circumvent that?
Node Based UIs for React and Svelte – xyflow
Powerful open source libraries for building node-based UIs with React or Svelte. Ready out-of-the-box and infinitely customizable.
14 Replies
rubenf
rubenf2mo ago
you need to bundle it within
alex4o
alex4o2mo ago
but you already alias react with https://unpkg.com/react@18.2.0/umd/react.development.js in the example component how can I bundle only jsxRuntime?
rubenf
rubenf2mo ago
I think i'm lacking context, I have no idea what adding jsxRuntime entails
alex4o
alex4o2mo ago
resolve:
mode === "development"
? {}
: {
alias: {
react: "https://unpkg.com/react@18.2.0/umd/react.development.js",
"react-dom":
"https://unpkg.com/react-dom@18.2.0/umd/react-dom.development.js",
},
},
resolve:
mode === "development"
? {}
: {
alias: {
react: "https://unpkg.com/react@18.2.0/umd/react.development.js",
"react-dom":
"https://unpkg.com/react-dom@18.2.0/umd/react-dom.development.js",
},
},
I mean here react and react-dom are alias which marks them as external which makes react/jsx-runtime external as well
rubenf
rubenf2mo ago
so it works in dev but not when imported in windmill ?
alex4o
alex4o2mo ago
yes
rubenf
rubenf2mo ago
Would you have the error you see in windmill and could you share a repo that does a minimal reproduction of the issue please
alex4o
alex4o2mo ago
At first I get React$1 is undefined then when I add
rollupOptions: {
output: {
format: "iife",
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
rollupOptions: {
output: {
format: "iife",
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
I get jsxRuntime is not defined Here is an example repo with the canges I made: https://github.com/alex4o/windmill-component-example-error/commit/4bf6ee3aff6b1c282280da3155d1bc377e504d75
No description
No description
rubenf
rubenf2mo ago
thanks, adding to backlog to investigate this
alex4o
alex4o2mo ago
thank you, I tried a few other things but couldn't get it to work
rubenf
rubenf2mo ago
@alex4o this is the only fix that is needed
rubenf
rubenf2mo ago
No description
alex4o
alex4o2mo ago
Thank you, I will try it in a bit