Select to view content in your preferred language

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

312
0
03-06-2023 01:38 PM
MichaelKowal
Emerging Contributor

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