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
The micro frontends will pick it up, if they are bootstrapped with the ``bootstrap`` helper (see above).
117
+
118
+
## Details on ngZone and Platform sharing
119
+
120
+
> In a multi version micro frontend strategy, it is important to load the zone.js bundle to the window object only once. Also, one need to make sure that only one instance of the ngZone is used by all the micro frontends.
121
+
122
+
If you share `@angular/core` and therefore also have one technical reference to the BrowserPlatform, that is used by more than one micro frondend, Angular's default setup is, to support only one platform instance per shared version. Be aware that you **need** to create multi platform instances in case of different versions, but also in case the version is the same, but `@angular/core` is not shared, but packed into the micro frontend's bundles directly (like in Angular's default way w/o module federation).
123
+
124
+
Naturally, such technical details are hard to get into. Therefore the `bootstrap()` function of this package helps to implement your multi version strategy w/o the need of implementing those low-level aspects on your own.
125
+
126
+
Some optional flags are offered to provide options for custom behavior of the `bootstrap()` function:
127
+
128
+
-`ngZoneSharing: false`: Deactivate ngZone sharing in the window object (not recommended):
129
+
```typescript
130
+
bootstrap(AppModule, {
131
+
production: environment.production,
132
+
ngZoneSharing: false// defaults to true
133
+
});
134
+
```
135
+
-`platformSharing: false`: Deactivate Platform sharing in the window object (not recommended):
136
+
```typescript
137
+
bootstrap(AppModule, {
138
+
production: environment.production,
139
+
platformSharing: false// defaults to true
140
+
});
141
+
```
142
+
- Possible, if dependencies are not shared or each bootstrapped remote app uses a different version.
143
+
-`activeLegacyMode: false`: Deactivates the legacy mode that provides backwards compatibility for Platform sharing:
144
+
```typescript
145
+
bootstrap(AppModule, {
146
+
production: environment.production,
147
+
activeLegacyMode: false// defaults to true
148
+
});
149
+
```
150
+
- If all your micro frontends use `@angular-architects/module-federation-tools` in version `^12.6.0`, `^13.1.0` or any newer major version you can switch off the legacy mode manually.
151
+
- Those versions introduced new features on how to share the Platform in the window object.
152
+
- This allows to use the `bootstrap()` function even in such cases, where the same version is packed into different micro frontend bundles.
153
+
154
+
94
155
## Routing to Web Components
95
156
96
157
The ``WebComponentWrapper`` helps you to route to web components:
The micro frontends will pick it up, if they are bootstrapped with the ``bootstrap`` helper (see above).
242
-
243
280
## More about the underlying ideas
244
281
245
282
Please find more information on the underlying ideas in this [blog article](https://www.angulararchitects.io/aktuelles/multi-framework-and-version-micro-frontends-with-module-federation-the-good-the-bad-the-ugly).
0 commit comments