You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/guide/advanced/module-federation.mdx
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@ In this way, we have completed the integration of Rslib Module as a producer. Af
87
87
88
88
In the above example we added a new `format: 'mf'` , which will help you add an additional Module Federation product, while also configuring the format of `cjs` and `esm` , which does not conflict.
89
89
90
-
However, if you want this Rslib Module to consume other producers at the same time, do not use the build configuration `remote` parameter, because in other formats, this may cause errors, please refer to the example below using the Module Federation runtime
90
+
However, if you want this Rslib Module to consume other producers at the same time, do not use the build configuration `remote` parameter, because in other formats, this may cause errors, please refer to the example below using the Module Federation runtime.
91
91
92
92
## Develop MF remote module
93
93
@@ -313,6 +313,8 @@ This ensures that modules can be loaded as expected in multiple formats.
313
313
314
314
## FAQs
315
315
316
+
### How to control the loading strategy of shared dependencies when the producer and consumer build patterns are different
317
+
316
318
If the Rslib producer is built with build, this means that the `process.env.NODE_ENV` of the producer is `production` . If the consumer is started in dev mode at this time,
317
319
due to the shared loading strategy of Module Federation being `version-first` by default, there may be problems loading into different modes of react and react-dom (e.g. react in development mode, react-dom in production mode).
318
320
You can set up [shareStrategy](https://module-federation.io/configure/sharestrategy) at the consumer to solve this problem, but make sure you fully understand this configuration
@@ -324,6 +326,29 @@ pluginModuleFederation({
324
326
}),
325
327
```
326
328
329
+
### How to make module federated outputs generate export of ES modules
330
+
331
+
If you want Rslib producers' module federated outputs to generate the export of ES Modules, you can additionally configure as follows:
0 commit comments