-
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
222 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,10 @@ | |
"type": "dir", | ||
"name": "dev", | ||
"label": "插件开发" | ||
}, | ||
{ | ||
"type": "dir", | ||
"name": "plugins", | ||
"label": "Plugins" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["index","auto-preload"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { PackageManagerTabs, Tabs, Tab } from '@theme'; | ||
|
||
# Auto Preload Plugin | ||
|
||
当加载远程模块时,会自动预加载相应的远程模块资源。 | ||
|
||
## Usage | ||
|
||
该运行时插件由 `@module-federation/auto-preload` 提供 | ||
|
||
<PackageManagerTabs | ||
command={{ | ||
npm: 'npm add @module-federation/auto-preload --save', | ||
yarn: 'yarn add @module-federation/auto-preload --save', | ||
pnpm: 'pnpm add @module-federation/auto-preload --save', | ||
bun: 'bun add @module-federation/auto-preload --save', | ||
}} | ||
/> | ||
|
||
|
||
### 配置 | ||
|
||
此插件可在**运行时阶段**或**构建插件**中应用。你可以根据你的场景灵活选择。 | ||
|
||
<Tabs> | ||
<Tab label="Rspack"> | ||
```typescript title="rspack.config.js" | ||
const {ModuleFederationPlugin} = require('@module-federation/enhanced/rspack'); | ||
|
||
new ModuleFederationPlugin({ | ||
// other options | ||
runtimePlugins: [ | ||
require.resolve('@module-federation/auto-preload') | ||
] | ||
}); | ||
``` | ||
</Tab> | ||
<Tab label="Webpack"> | ||
```typescript title="webpack.config.js" | ||
const {ModuleFederationPlugin} = require('@module-federation/enhanced/webpack'); | ||
|
||
new ModuleFederationPlugin({ | ||
// other options | ||
runtimePlugins: [ | ||
require.resolve('@module-federation/auto-preload') | ||
] | ||
}); | ||
``` | ||
</Tab> | ||
<Tab label="Module Federation Runtime"> | ||
```typescript title="app.js" | ||
import { init } from '@module-federation/runtime'; | ||
import autoPreloadPlugin from '@module-federation/auto-preload'; | ||
init({ | ||
name: '@demo/app-main', | ||
remotes: [ | ||
{ | ||
name: '@demo/app2', | ||
entry: 'http: //localhost:3006/mf-manifest.json', | ||
alias: 'app2', | ||
}, | ||
], | ||
plugins: [autoPreloadPlugin()], | ||
}); | ||
``` | ||
</Tab> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { PackageManagerTabs, Tabs, Tab } from '@theme'; | ||
|
||
# Node Plugin | ||
|
||
|
||
服务器端的模块联邦为后端架构提供了多种可能性,并支持应用程序的服务器端渲染。 | ||
|
||
## 使用 | ||
|
||
该运行时插件由 `@module-federation/node` 提供 | ||
|
||
<PackageManagerTabs | ||
command={{ | ||
npm: 'npm add @module-federation/enhanced @module-federation/node --save', | ||
yarn: 'yarn add @module-federation/enhanced @module-federation/node --save', | ||
pnpm: 'pnpm add @module-federation/enhanced @module-federation/node --save', | ||
bun: 'bun add @module-federation/enhanced @module-federation/node --save', | ||
}} | ||
/> | ||
|
||
|
||
### 配置 | ||
|
||
此插件可在**运行时阶段**或**构建插件**中应用。你可以根据你的场景灵活选择。 | ||
|
||
<Tabs> | ||
<Tab label="Rspack"> | ||
```typescript title="rspack.config.js" | ||
const {ModuleFederationPlugin} = require('@module-federation/enhanced/rspack'); | ||
|
||
new ModuleFederationPlugin({ | ||
// other options | ||
runtimePlugins: [ | ||
require.resolve('@module-federation/node/runtimePlugin') | ||
] | ||
}); | ||
``` | ||
</Tab> | ||
<Tab label="Webpack"> | ||
```typescript title="webpack.config.js" | ||
const {ModuleFederationPlugin} = require('@module-federation/enhanced/webpack'); | ||
|
||
new ModuleFederationPlugin({ | ||
// other options | ||
runtimePlugins: [ | ||
require.resolve('@module-federation/node/runtimePlugin') | ||
] | ||
}); | ||
``` | ||
</Tab> | ||
<Tab label="Module Federation Runtime"> | ||
```typescript title="app.js" | ||
import {init} from '@module-federation/runtime'; | ||
import nodeRuntimePlugin from '@module-federation/node/runtimePlugin'; | ||
init({ | ||
name: '@demo/app-main', | ||
remotes: [ | ||
{ | ||
name: '@demo/app2', | ||
entry: 'http: //localhost:3006/mf-manifest.json', | ||
alias: 'app2', | ||
}, | ||
], | ||
plugins: [nodeRuntimePlugin()], | ||
}); | ||
``` | ||
</Tab> | ||
</Tabs> |
Oops, something went wrong.