For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/plugins/module-federation-plugin-v1.md.
close

ModuleFederationPluginV1

该插件对应 Module Federation v1.0,即 webpack 中的 ModuleFederationPlugin

Tip

Module Federation v1.0 已经不再迭代,我们推荐使用 Module Federation v1.5 或 v2.0 版本,详见 模块联邦

示例

rspack.config.mjs
import { rspack } from '@rspack/core';

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

选项

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

name 是必填选项。公共字段的详细说明请参考 ModuleFederationPlugin 选项。Module Federation v1 不支持 implementationruntimePluginsshareStrategy