Fallback plugin :: errorLoadRemote almost working, not returning module correctly #3891
-
I would appreciate any help with this. Scenario: The MFE stuff works fine when the environments are up and running as expected, however I need to make sure things are handled "gracefully" if/when the mf-manifest.json cannot be retrieved from the server because that throws errors prior to it arriving at the Errorboundary of the loading component. So I used the fallback hook and Component loading code from the documentation at : It "almost works" but I am getting this error thrown before it gets to the container's own ErrorBoundary:
Warning: lazy: Expected the result of a dynamic import() call. Instead received: () => ({ Which is exactly what is being returned from the fallback plugin in the documentation. I've tried changing the return a bit but only the text after "Instead received...." error changes slightly Once the error is cleared from the screen, the component is showing the Errorboundary correctly Code snippets: Fallback plugin: const fallbackPlugin = (config: FallbackConfig = {}): FederationRuntimePlugin => { return {
}; Loader Component code: import React, { FC, Suspense } from 'react'; const Remote1AppWithLoadRemote = React.lazy(() => loadRemote('myapp/MfeApp')); Error loading Remote App... }><Suspense fallback={ Loading Remote1App... }><Remote1AppWithLoadRemote {...props} ref={ref} /> )); export const MfeContainer: FC = () => { return ( }; export default MfeContainer; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
try without the ()=> so just return { and see if that works. or look at the nextjs mf runtime plugin and how we deal with it |
Beta Was this translation helpful? Give feedback.
try without the ()=>
so just return {
default: thing
}
and see if that works. or look at the nextjs mf runtime plugin and how we deal with it