Skip to content

Commit de80bb5

Browse files
Change default value of singleton option from true to false (#3416)
Co-authored-by: ScriptedAlchemy <[email protected]> Co-authored-by: Zack Jackson <[email protected]>
1 parent b4a8548 commit de80bb5

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ new ModuleFederationPlugin({
4444

4545
- Type: `boolean`
4646
- Required: No
47-
- Default: `true`
47+
- Default: `false`
4848

4949
Whether to allow only one version of the shared module within the shared scope (singleton mode).
5050

apps/website-new/docs/zh/configure/shared.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ new ModuleFederationPlugin({
4444

4545
- 类型:`boolean`
4646
- 是否必填:否
47-
- 默认值:`true`
47+
- 默认值:`false`
4848

4949
是否在共享作用域中只允许共享模块的一个版本 (单例模式).
5050

5151
- 如果值为 true,开启单例模式;值为 false,不开启单例模式。
52-
- 如果启用单例模式,那么 remote 应用组件和 host 应用共享的依赖只加载一次,当版本不一致时加载更高的版本。此时对于版本更低的那一方会给出警告
53-
- 不开启单例模式下,如果 remote 应用和 host 应用共享依赖的版本不一致,则 remote 应用和 host 应用加载各自的依赖
52+
- 如果启用单例模式,那么 remote 应用组件和 host 应用共享的依赖只加载一次,当版本不一致时加载更高的版本。此时对于版本更低的那一方会给出警告
53+
- 不开启单例模式下,如果 remote 应用和 host 应用共享依赖的版本不一致,则 remote 应用和 host 应用加载各自的依赖
5454

5555
## requiredVersion
5656

@@ -61,7 +61,7 @@ new ModuleFederationPlugin({
6161
所需版本,可以是一个版本区间。默认值为当前应用的依赖版本。
6262

6363
- 在使用共享依赖时,会判断该依赖版本是否大于等于 requiredVersion ,如果是则会正常使用。如果小于 requiredVersion 那么会在控制台警告,并使用当前共享依赖中最小的版本。
64-
- 当一方设置 requiredVersion ,另一方设置 singleton 时,会加载 requiredVersion 的依赖,singleton 方直接使用 requiredVersion 的依赖,不论版本高低
64+
- 当一方设置 requiredVersion ,另一方设置 singleton 时,会加载 requiredVersion 的依赖,singleton 方直接使用 requiredVersion 的依赖,不论版本高低
6565

6666
## eager
6767

@@ -121,13 +121,13 @@ new ModuleFederationPlugin({
121121
```ts
122122
new ModuleFederationPlugin({
123123
name: '@demo/button',
124-
shared: {
125-
react: {
126-
singleton: true,
127-
requiredVersion: '~18.2.0'
128-
fixedDependencies: true
129-
}
124+
shared: {
125+
react: {
126+
singleton: true,
127+
requiredVersion: '~18.2.0',
128+
fixedDependencies: true
130129
}
130+
},
131131
//...
132132
});
133133
```

0 commit comments

Comments
 (0)