-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime init and loadRemote methods are contain different remote (FederationInstance) when trying load exposed module #1942
Comments
@2heal1 any comments about this? |
@satheesh66 Can you describe the problem with reusing a global instance? |
we trying to use runtime plugin as hybrid mode in this approach when i trying to invoke init with host for some remote service the federation instance already holding previously loaded remote(via promise) instead host |
I need some clarification I am triggering |
any update on this? @zhoushaw @ScriptedAlchemy |
@satheesh66 I'm sorry I didn't understand what you meant. Can you provide a warehouse? How should the normal performance be |
Yes , currently , if you invoke
|
In this case , you want to update the remote entry which has been registered before ? @zhoushaw @ScriptedAlchemy Should we allow users to merge remote instead of skip ? And how about adding |
registerRemotes: (remotes: Remote[], override?:boolean) => void;
interface Remote {
name:string;
entry:string;
override?: boolean
} But I'm not sure if we are allowed to control whether a single remote can be override. Maybe it's enought that we just add @ScriptedAlchemy What do you think? |
{init,registerRemote} from runtime? something like that could work, but be warned - sideloading remotes after federation is already initalized the "initial" remotes it had, if you add more remotes later, the already initalized containers from app startup cannot "see" updated share scopes as they are already running and using shared modules. So i agree we need a way to add more remotes to federation, BUT be warned that there are race conditions that can occur. For example You have 3 remotes. A, B, C A is the host App will fail because B was init() with share scope that existed, A's share scope, B cannot see what new shared modules C added because B was "sealed" already When you loaded C, it added redux but B cannot see that because it was already inialized with the share scope known at that point in time. So it will load another redux copy. |
Okay we are adding a new api for addRemote It should do what you want. |
Yes , the conclude as follows:
I will open a pr for this feature during the following days cc @zhoushaw |
Console warn not error. |
yes :D |
HI @ScriptedAlchemy @2heal1 , Note: using - "@module-federation/enhanced": "^0.0.10" My Scenario :main service (Host) widgets service is injected to main in build time using promise based dynamic injection, so that i can directly using that in main, and i am trying init and load primitives service in runtime using a component that resides in widgets service.
widgets service (Remote) The init and loadRemote will work with widgets service's
primitives service(remote)
|
So you have declared remote(widgets service) in your build config , and you want to use
|
yes, my Widget service's entry file is already in browser but Primitives service is not in the browser, so i need to now I just register my Primitive service inside widgets service it will registers remotes to widgets service and then i can use |
@satheesh66 yes, if the remote name is the same , you need to use If the issue can not be solved , you can give the reproduce repo , and i will take a further look. |
Issue solved. Thank you @2heal1 @ScriptedAlchemy. looking forward to registerRemote stable release. |
v0.0.17 release |
Describe the bug
Hi,
I have using module-federation/runtime ,
I am trying to load the remote and then trying access the exposed module , here my host is
main
when invoke loadRemote method the
FederationInstance
is not holdingmain
instead it holds other remote that is previously loaded because of the condition in@module-federation/runtime
'sinit
method in line number 1684, since we declared theFederationInstance
variable outside of theinit
andloadRemote
method's scope, so it holding previous remote.if i change the condition to
if(FederationInstance !== instance)
it's working as expected,Reproduction
Used Package Manager
npm
System Info
Validations
The text was updated successfully, but these errors were encountered: