Unable to use react library that was transpiled using "react-jsx"

223
0
03-06-2023 01:38 PM
MichaelKowal
New Contributor II

I am trying to consume a package that imports "react/jsx-runtime".  The webpack config that compiles the custom widgets doesn't catch imports to react subdirectories and causes a second instance of react to be loaded at runtime. 

A similar issue can be seen if a package uses react/react-dom v18+.  Importing react-dom/client will load a new instance of react-dom instead of the one that is loaded via jimu-core.  Adding "react/" and "react-dom/" to the list of partialMatchPackages in the webpack config should fix the issue.

Tags (2)
0 Kudos
0 Replies