-
-
Notifications
You must be signed in to change notification settings - Fork 334
docs: add FederationHost class usage description #3827
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
base: main
Are you sure you want to change the base?
Conversation
|
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@ScriptedAlchemy I plan to add the FederationHost usage description , what do you think , should we export it ? |
@@ -449,6 +449,31 @@ registerPlugins([runtimePlugin()]); | |||
|
|||
If you want to develop Module Federation plugin, you can read [Module Federation Plugin System](../../plugin/dev/index) for more info. | |||
|
|||
## FederationHost | |||
|
|||
In addition to exposing APIs, Federation Runtime also provides the FederationHost class, which you can use to create a FederationHost instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to exposing APIs, Federation Runtime also provides the FederationHost class, which you can use to create a FederationHost instance. | |
In addition to exposing APIs, the Federation Runtime also provides a FederationHost class, which you can use to create FederationHost instances. |
|
||
In addition to exposing APIs, Federation Runtime also provides the FederationHost class, which you can use to create a FederationHost instance. | ||
|
||
* When to use `FederationHost` ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be a good idea to have small section on "What is FederationHost"
How i explained it to people before was that in the FEDERATION.INSTANCES - each runtime or application who uses module federation creates a FederationHost instance, it represents an both consumer and provider instances of the system. Or something so users understand what federation host actually is for
|
||
* When to use `FederationHost` ? | ||
|
||
To ensure the uniqueness of the FederationHost instance, after the build plugin creates an instance, it will be stored in memory. The exported APIs all first obtain the FederationHost instance from memory and then call the APIs of the FederationHost instance. This is also why APIs like loadRemote can be used directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure the uniqueness of the FederationHost instance, after the build plugin creates an instance, it will be stored in memory. The exported APIs all first obtain the FederationHost instance from memory and then call the APIs of the FederationHost instance. This is also why APIs like loadRemote can be used directly. | |
To ensure the uniqueness of the FederationHost instance, after the build plugin creates an instance, it will be stored in memory. The exported APIs all first obtain the FederationHost instance from memory and then call the APIs of the FederationHost instance. This is also why APIs like loadRemote can be used directly from the `module-federation/runtime` package and inherently understand what application container they are attached to. |
|
||
To ensure the uniqueness of the FederationHost instance, after the build plugin creates an instance, it will be stored in memory. The exported APIs all first obtain the FederationHost instance from memory and then call the APIs of the FederationHost instance. This is also why APIs like loadRemote can be used directly. | ||
|
||
However, this singleton pattern also limits the inability to create multiple instances. Therefore, if you need to create a new instance , you can use the FederationHost class to create a new one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, this singleton pattern also limits the inability to create multiple instances. Therefore, if you need to create a new instance , you can use the FederationHost class to create a new one. | |
However, this singleton pattern also limits the ability to create multiple instances, as it assumes that there is only one instance per bundle. Therefore, if you need to create a new instance , you can use the FederationHost class to create a new one. |
got, l will update this |
Description
add FederationHost class usage description
Related Issue
Types of changes
Checklist