Skip to content

Commit 61e49a9

Browse files
committed
feat: add createInstance api
1 parent 0c134a0 commit 61e49a9

File tree

24 files changed

+74
-67
lines changed

24 files changed

+74
-67
lines changed

apps/website-new/docs/en/configure/experiments.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ This object contains flags related to build-time optimizations that can affect t
7474
- **Required:** No
7575
- **Default:** `false`
7676

77-
When set to `true`, this option defines the `FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN` global constant as `true` during the build. In the `@module-federation/runtime-core`, this prevents the `snapshotPlugin()` and `generatePreloadAssetsPlugin()` from being included and initialized within the FederationHost.
77+
When set to `true`, this option defines the `FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN` global constant as `true` during the build. In the `@module-federation/runtime-core`, this prevents the `snapshotPlugin()` and `generatePreloadAssetsPlugin()` from being included and initialized within the Module Federation instance.
7878

7979
**Impact:**
8080
* **Benefit:** Can reduce the overall bundle size of the Module Federation runtime by excluding the code for these two plugins.

apps/website-new/docs/en/configure/exposes.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Example:
3232
```jsx
3333
module.exports = {
3434
plugins: [
35-
new ModuleFederation({
35+
new ModuleFederationPlugin({
3636
name: 'provider',
3737
exposes: {
3838
// Note: "./" is not supported. Exporting as `.` indicates a default export

apps/website-new/docs/en/configure/getpublicpath.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ If you're using module federation webpack plugin and want to set a dynamic publi
2020
```ts title="rspack.config.ts"
2121
module.exports = {
2222
plugins: [
23-
new ModuleFederation({
23+
new ModuleFederationPlugin({
2424
name: 'provider',
2525
exposes: {
2626
'./Button': './src/components/Button.tsx',

apps/website-new/docs/en/configure/implementation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For example, if you want to use a specific version of `@module-federation/runtim
1616
module.exports = {
1717
// ...other configurations
1818
plugins: [
19-
new ModuleFederation({
19+
new ModuleFederationPlugin({
2020
// ...other Module Federation options
2121
implementation: require.resolve('@module-federation/runtime-tools'),
2222
}),

apps/website-new/docs/en/configure/remotes.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface PluginRemoteOptions {
3131
```js
3232
module.exports = {
3333
plugins: [
34-
new ModuleFederation({
34+
new ModuleFederationPlugin({
3535
name: 'host',
3636
// The `remotes` below defines two remotes, named `manifest-provider` for the project started on port 3011 and `js-entry-provider` for the project started on port 3012
3737
remotes: {

apps/website-new/docs/en/configure/runtimeplugins.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Then, apply this plugin in your build configuration:
3636
const path = require('path');
3737
module.exports = {
3838
plugins: [
39-
new ModuleFederation({
39+
new ModuleFederationPlugin({
4040
name: 'host',
4141
remotes: {
4242
'manifest-provider':

apps/website-new/docs/en/guide/basic/runtime/runtime-api.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ To ensure the uniqueness of the ModuleFederation instance, after the build plugi
2424
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 ModuleFederation class to create a new one.
2525

2626
```ts
27-
import { ModuleFederation } from '@module-federation/enhanced/runtime';
27+
import { createInstance } from '@module-federation/enhanced/runtime';
2828

29-
const mf = new ModuleFederation({
29+
const mf = createInstance({
3030
name: '@demo/host',
3131
remotes: [
3232
{
@@ -216,9 +216,9 @@ If not use build plugin:
216216

217217

218218
```ts
219-
import { ModuleFederation, registerRemotes } from '@module-federation/enhanced/runtime';
219+
import { createInstance, registerRemotes } from '@module-federation/enhanced/runtime';
220220

221-
const mf = new ModuleFederation({
221+
const mf = createInstance({
222222
name: 'mf_host',
223223
remotes: [
224224
{

apps/website-new/docs/en/guide/basic/runtime/runtime-hooks.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ type ErrorLoadRemoteOptions ={
166166
* example
167167
168168
```ts
169-
import { ModuleFederation, loadRemote } from '@module-federation/enhanced/runtime'
169+
import { createInstance, loadRemote } from '@module-federation/enhanced/runtime'
170170

171171
import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
172172

@@ -182,7 +182,7 @@ const fallbackPlugin: () => ModuleFederationRuntimePlugin =
182182
};
183183

184184

185-
const mf = new ModuleFederation({
185+
const mf = createInstance({
186186
name: 'mf_host',
187187
remotes: [
188188
{
@@ -269,7 +269,7 @@ const customSharedPlugin: () => ModuleFederationRuntimePlugin =
269269
};
270270

271271

272-
const mf = new ModuleFederation({
272+
const mf = createInstance({
273273
name: 'mf_host',
274274
shared: {
275275
react: {

apps/website-new/docs/en/guide/basic/runtime/runtime.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ registerRemotes([
7777
If the build plugin is not used and no instance has been created, you can create a new instance and register the modules.
7878

7979
```ts
80-
import { ModuleFederation } from '@module-federation/enhanced/runtime';
80+
import { createInstance } from '@module-federation/enhanced/runtime';
8181

82-
const mf = new ModuleFederation({
82+
const mf = createInstance({
8383
name: 'mf_host',
8484
remotes: [
8585
{

apps/website-new/docs/en/plugin/dev/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Registering plugins (either method is acceptable):
5757
const path = require('path');
5858
module.exports = {
5959
plugins: [
60-
new ModuleFederation({
60+
new ModuleFederationPlugin({
6161
// ...
6262
runtimePlugins: [path.resolve(__dirname, './custom-runtime-plugin.ts')],
6363
}),

0 commit comments

Comments
 (0)