> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# ModuleFederationPluginV1

该插件对应 Module Federation v1.0，即 [webpack 中的 ModuleFederationPlugin](https://webpack.js.org/plugins/module-federation-plugin/)。

:::tip
Module Federation v1.0 已经不再迭代，我们推荐使用 Module Federation v1.5 或 v2.0 版本，详见 [模块联邦](/zh/guide/advanced/module-federation.md)。
:::

## 示例

```js title="rspack.config.mjs"
import { rspack } from '@rspack/core';

export default {
  plugins: [
    new rspack.container.ModuleFederationPluginV1({
      name: 'host',
    }),
  ],
};
```

## 选项

- **类型：**

```ts
interface ModuleFederationPluginV1Options {
  name?: string;
  filename?: string;
  exposes?: Exposes;
  remotes?: Remotes;
  shared?: Shared;
  runtime?: EntryRuntime;
  shareScope?: ShareScope;
  remoteType?: ExternalsType;
  library?: LibraryOptions;
  enhanced?: boolean;
}
```

暴露模块时必须提供 `name`。如果插件只配置远程模块或共享依赖，或未启用任何选项，则可以省略。公共字段的详细说明请参考 [ModuleFederationPlugin 选项](/zh/plugins/module-federation-plugin.md#选项)。Module Federation v1 不支持 `implementation`、`runtimePlugins` 或 `shareStrategy`。
