You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interface BasicProviderModuleInfo extends BasicModuleInfo {
// ssrRemoteEntry/ssrRemoteEntryType only appear while manifest has serveSideRemoteEntry field
+ ssrRemoteEntry?: string;+ ssrRemoteEntryType?: RemoteEntryType
}
render mode
only support stream ssr mode
CSS flickering issue
Leverage mf-stats.json , we can easily get the module css assets, and insert them to html
// encapsulation component for usersconstComp=React.lazy(()=>loadRemote('dynamic_remote/Image').then((m)=>{return{default:()=><div><linkhref='http://localhost:3008/static/css/async/__federation_expose_Image.css'rel="stylesheet"type="text/css"/><span>11</span><m.default/></div>};}),);
Cache Strategy
For static remote , there won't be any serious problems. But for dynamic remotes , it may add endless dynamic remotes , and cause memory crashes.
To avoid the issue , it needs to add LRU cache:
Delete the reference of least usage mf instance, include the shared and expose modules
Summary
Module Federation supports Modern.js SSR , includes stream ssr and string ssr two modes.
Basic example
Motivation
Detailed design
Update stats/manifest/snapshot
Stats/Manifest
Add ssr related fields
// metaData interface BasicStatsMetaData { + ssrRemoteEntry?: ResourceInfo; }
Snapshot
Add ssr related fields
render mode
only support stream ssr mode
CSS flickering issue
Leverage mf-stats.json , we can easily get the module css assets, and insert them to html
Cache Strategy
For static remote , there won't be any serious problems. But for dynamic remotes , it may add endless dynamic remotes , and cause memory crashes.
To avoid the issue , it needs to add LRU cache:
Data Fetch
Use Modernjs Data loader
Downgrade strategy
Provide two ways to help CSR cab work normally while SSR failed
Dev
LiveReload
fetch all loaded remotes before render host , and judge whether remoteEntry content hash has changed . If yes , flush chunks .
Dynamic remote type hints
notify local broker server while calling loadRemotes , and then the broker server will have the full relationship .
debug
Because node server can not access local env , so not support yet.
It will auto forceCSR when accepting the debug info:
Drawbacks
The text was updated successfully, but these errors were encountered: