module-federation / module-federation-examples

Implementation examples of module federation , by the creators of module federation
https://module-federation.io/
MIT License
5.52k stars 1.73k forks source link

Integrating React 17 Remote Entry MFE with Host Application React 18 #4251

Open wsh92 opened 1 month ago

wsh92 commented 1 month ago

Manifest file and remoteEntry.js files are loading in the host application but getting following runtime error while trying to load the child remote app using the router.

Element type is invalid. Received a promise that resolves to: undefined. Lazy element type must resolve to a class or function.
    at mountLazyComponent (webpack://host-app/./node_modules/react-dom/cjs/react-dom.development.js?:20037:9)
    at beginWork (webpack://host-app/./node_modules/react-dom/cjs/react-dom.development.js?:21627:16)
    at HTMLUnknownElement.callCallback (webpack://host-app/./node_modules/react-dom/cjs/react-dom.development.js?:4164:14)
    at Object.invokeGuardedCallbackDev (webpack://host-app/./node_modules/react-dom/cjs/react-dom.development.js?:4213:16)
    at invokeGuardedCallback (webpack://host-app/./node_modules/react-dom/cjs/react-dom.development.js?:4277:31)
    at beginWork$1 (webpack://host-app./node_modules/react-dom/cjs/react-dom.development.js?:27485:7)
    at performUnitOfWork (webpack://host-app/./node_modules/react-dom/cjs/react-dom.development.js?:26591:12)
    at workLoopConcurrent (webpack://host-app./node_modules/react-dom/cjs/react-dom.development.js?:26577:5)
    at renderRootConcurrent (webpack:/host-app./node_modules/react-dom/cjs/react-dom.development.js?:26539:7)
    at performConcurrentWorkOnRoot (webpack://host-app/./node_modules/react-dom/cjs/react-dom.development.js?:25772:38)

Host Application - React 18 Remote Child Application - React 17

I have used the following example to setup my project. https://github.com/module-federation/module-federation-examples/tree/master/different-react-versions-16-18

ScriptedAlchemy commented 1 month ago

Need to check this project again, E2E was failing