Open p12y opened 2 months ago
Ill need to check this again, its been a while and we have since created the framework bridge capability.
You also have to return an object with a default key. So loading remotely may not work without returning an object like {default: value}.
Problem
Multiple react version runtime plugin example does not work with
loadRemote
, onlyimport
.Example
https://github.com/module-federation/module-federation-examples/tree/master/runtime-plugins/multiple-react-versions
To recreate
In
app1/App.js
, update the lazy imports to useloadRemote
instead ofimport
:Expected behaviour
The app should continue to work as expected
Actual behaviour
The app crashes with "ERROR Element type is invalid. Received a promise that resolves to: undefined. Lazy element type must resolve to a class or function."
Impact
The plugin approach to supporting multiple react versions does not work when using the runtime utils, which are needed when loading modules dynamically.