File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ new ModuleFederationPlugin({
44
44
45
45
- Type: ` boolean `
46
46
- Required: No
47
- - Default: ` true `
47
+ - Default: ` false `
48
48
49
49
Whether to allow only one version of the shared module within the shared scope (singleton mode).
50
50
Original file line number Diff line number Diff line change @@ -44,13 +44,13 @@ new ModuleFederationPlugin({
44
44
45
45
- 类型:` boolean `
46
46
- 是否必填:否
47
- - 默认值:` true `
47
+ - 默认值:` false `
48
48
49
49
是否在共享作用域中只允许共享模块的一个版本 (单例模式).
50
50
51
51
- 如果值为 true,开启单例模式;值为 false,不开启单例模式。
52
- - 如果启用单例模式,那么 remote 应用组件和 host 应用共享的依赖只加载一次,当版本不一致时加载更高的版本。此时对于版本更低的那一方会给出警告:
53
- - 不开启单例模式下,如果 remote 应用和 host 应用共享依赖的版本不一致,则 remote 应用和 host 应用加载各自的依赖
52
+ - 如果启用单例模式,那么 remote 应用组件和 host 应用共享的依赖只加载一次,当版本不一致时加载更高的版本。此时对于版本更低的那一方会给出警告。
53
+ - 不开启单例模式下,如果 remote 应用和 host 应用共享依赖的版本不一致,则 remote 应用和 host 应用加载各自的依赖。
54
54
55
55
## requiredVersion
56
56
@@ -61,7 +61,7 @@ new ModuleFederationPlugin({
61
61
所需版本,可以是一个版本区间。默认值为当前应用的依赖版本。
62
62
63
63
- 在使用共享依赖时,会判断该依赖版本是否大于等于 requiredVersion ,如果是则会正常使用。如果小于 requiredVersion 那么会在控制台警告,并使用当前共享依赖中最小的版本。
64
- - 当一方设置 requiredVersion ,另一方设置 singleton 时,会加载 requiredVersion 的依赖,singleton 方直接使用 requiredVersion 的依赖,不论版本高低
64
+ - 当一方设置 requiredVersion ,另一方设置 singleton 时,会加载 requiredVersion 的依赖,singleton 方直接使用 requiredVersion 的依赖,不论版本高低。
65
65
66
66
## eager
67
67
@@ -121,13 +121,13 @@ new ModuleFederationPlugin({
121
121
``` ts
122
122
new ModuleFederationPlugin ({
123
123
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
130
129
}
130
+ },
131
131
// ...
132
132
});
133
133
```
You can’t perform that action at this time.
0 commit comments