Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion website/docs/en/config/module-federation/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
description: "Used to configure the Rspack's Module Federation plugin (Module Federation v1.5)."
---

import { PackageManagerTabs } from '@theme';

# moduleFederation.options

- **Type:** [Rspack.ModuleFederationPluginOptions](https://rspack.rs/plugins/webpack/module-federation-plugin#options)
Expand Down Expand Up @@ -38,7 +40,11 @@ export default defineConfig({
});
```

Please refer to the [ModuleFederationPlugin](https://rspack.rs/plugins/webpack/module-federation-plugin) document for all available options.
This option depends on the runtime package [@module-federation/runtime-tools](https://www.npmjs.com/package/@module-federation/runtime-tools), which provides runtime support for Module Federation. Install it first:

<PackageManagerTabs command="add @module-federation/runtime-tools" />

> Refer to the [ModuleFederationPlugin](https://rspack.rs/plugins/webpack/module-federation-plugin) document for all available options.
Comment thread
chenjiahan marked this conversation as resolved.
Comment thread
chenjiahan marked this conversation as resolved.

## Example

Expand Down
14 changes: 12 additions & 2 deletions website/docs/en/guide/upgrade/v1-to-v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,24 @@ In Node.js 20 and later, the runtime natively supports loading ESM modules via [

> This does not affect Rsbuild's ability to build CommonJS output. All related build behavior and configuration options remain unchanged.

## Polyfill dependency change
## Dependency changes

[core-js](https://www.npmjs.com/package/core-js) has been changed from a default dependency of `@rsbuild/core` to an optional peer dependency, which reduces the installation size by 1.2 MB.
### Polyfill

[core-js](https://www.npmjs.com/package/core-js) polyfill has been changed from a default dependency of `@rsbuild/core` to an optional peer dependency, which reduces the installation size by 1.2 MB.

If you enabled [output.polyfill](/config/output/polyfill), install `core-js` v3 in your project:

<PackageManagerTabs command="add core-js" />

### Module Federation

If you use the [moduleFederation.options](/config/module-federation/options) option, install `@module-federation/runtime-tools` manually in your project. In Rsbuild v2, it is an optional peer dependency of `@rspack/core`:
Comment thread
chenjiahan marked this conversation as resolved.
Outdated

<PackageManagerTabs command="add @module-federation/runtime-tools" />

This change only affects projects that use Module Federation v1.5 through `moduleFederation.options`. If you are using Module Federation v2, no action is required.

## Configuration

### Default server host
Expand Down
8 changes: 7 additions & 1 deletion website/docs/zh/config/module-federation/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
description: '用于配置 Rspack 模块联邦插件(对应模块联邦 v1.5)。'
---

import { PackageManagerTabs } from '@theme';

# moduleFederation.options

- **类型:** [Rspack.ModuleFederationPluginOptions](https://rspack.rs/zh/plugins/webpack/module-federation-plugin#options)
Expand Down Expand Up @@ -38,7 +40,11 @@ export default defineConfig({
});
```

请参考 [ModuleFederationPlugin](https://rspack.rs/zh/plugins/webpack/module-federation-plugin) 文档来了解所有可用的选项。
该选项依赖运行时包 [@module-federation/runtime-tools](https://www.npmjs.com/package/@module-federation/runtime-tools),用于提供模块联邦的运行时支持。请先安装该依赖:

Comment thread
chenjiahan marked this conversation as resolved.
<PackageManagerTabs command="add @module-federation/runtime-tools" />

> 参考 [ModuleFederationPlugin](https://rspack.rs/zh/plugins/webpack/module-federation-plugin) 文档来了解所有可用的选项。
Comment thread
chenjiahan marked this conversation as resolved.

## 示例

Expand Down
14 changes: 12 additions & 2 deletions website/docs/zh/guide/upgrade/v1-to-v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,24 @@ Rsbuild 2.0 最低支持的 Node.js 版本为 20.19+ 或 22.12+,不再支持 N

> 这一变更不影响 Rsbuild 构建 CommonJS 产物的能力,相关的构建行为和配置方式也保持不变。

## Polyfill 依赖变更
## 依赖变更

[core-js](https://www.npmjs.com/package/core-js) 从 `@rsbuild/core` 的默认依赖变更为可选的 peer 依赖,这减少了 1.2MB 的安装体积。
### Polyfill

[core-js](https://www.npmjs.com/package/core-js) polyfill 从 `@rsbuild/core` 的默认依赖变更为可选的 peer 依赖,这减少了 1.2MB 的安装体积。

如果你启用了 [output.polyfill](/config/output/polyfill),请在项目中安装 `core-js` v3:

<PackageManagerTabs command="add core-js" />

### Module Federation

如果你使用了 [moduleFederation.options](/config/module-federation/options) 选项,请在项目中手动安装 `@module-federation/runtime-tools`。在 Rsbuild v2 中,它现在是 `@rspack/core` 的 optional peer 依赖:
Comment thread
chenjiahan marked this conversation as resolved.
Outdated

<PackageManagerTabs command="add @module-federation/runtime-tools" />

这一变更仅影响通过 `moduleFederation.options` 使用 Module Federation v1.5 的项目。如果你使用的是 Module Federation v2,则不受影响。

## 配置

### 默认 host 变更
Expand Down