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: libs/native-federation/README.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,10 +25,15 @@ We will at least provide a new version of this package per Angular major. If nec
25
25
- Use version 17.x for Angular 17.x
26
26
- Use version 17.1.x for Angular 17.1+
27
27
- Use version 18.x for Angular 18+
28
+
- Use version 18.1.x for Angular 18.1+
29
+
30
+
## Migration from Module Federation
31
+
32
+
If you currently use Angular with Module Federation, you can follow our Migration Guide to migrate to Native Federation and Angular's new fast esbuild-based build system.
28
33
29
34
## Updates
30
35
31
-
You can use ng update for updating Native Federation.
36
+
You can use `ng update` for updating Native Federation.
32
37
33
38
Notes for [updating to version 18](https://github.com/angular-architects/module-federation-plugin/blob/main/libs/native-federation/docs/update18.md)
Copy file name to clipboardExpand all lines: libs/native-federation/docs/migrate.md
+153-2Lines changed: 153 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,164 @@ Native Federation for Angular is a thin wrapper around the esbuild builder that
9
9
## Prerequisites
10
10
11
11
- Update your solution to the newest Angular and CLI version
12
-
- Update your solution to the newest version of `@angular-architects/module-federation`
12
+
- Update your solution to the newest version of `@angular-architects/module-federation` (!)
13
13
- Have a look to our [FAQs about sharing packages with Native Federation](share-faq.md)
14
14
15
15
## Migration for Angular CLI projects
16
16
17
+
1. Remove Module Federation from your poject(s):
18
+
19
+
```
20
+
ng g @angular-architects/module-federation:remove --project xyz
21
+
```
22
+
23
+
2. Update your workspace to the new esbuild-based build system:
24
+
25
+
```
26
+
ng update @angular/cli --name use-application-builder
27
+
```
28
+
29
+
3. Initialize Native Federation for your projects:
30
+
31
+
```
32
+
ng add @angular-architects/native-federation --project xyz --type remote --port 4201
33
+
```
34
+
35
+
**Remarks:** Use type `remote` or type `dynamic-host`.
36
+
37
+
4. Adjust your `federation.config.js` generated for Native Federation. You can mostly copy over the settings from your `webpack.config.js` used for Module Federation before.
38
+
39
+
5. Update your EcmaScript imports in your source code. Make sure, you import from `@angular-architects/native-federation` instead of from `@angular-architects/module-federation`. Please also note that the signature of `loadRemoteModule` has been simplified:
40
+
41
+
```typescript
42
+
// Before
43
+
import { loadRemoteModule } from '@angular-architects/module-federation';
Please also note that loadRemoteModule now always points to a logical name that is resolved via the shell's federation manifest (`src/assets/federation.manifest.json` or `public/federation.manifest.json`):
81
+
82
+
```json
83
+
{
84
+
"mfe1": "http://localhost:4201/remoteEntry.json"
85
+
}
86
+
```
87
+
88
+
Please also note that the remoteEntry is now a `.json` file.
89
+
90
+
6. If everything works, delete your `webpack.config.js`
91
+
92
+
17
93
## Migration for Nx projects
18
94
95
+
1. Remove Module Federation from your poject(s):
96
+
97
+
```
98
+
nx g @angular-architects/module-federation:remove --project xyz
99
+
```
100
+
101
+
2. Initialize Native Federation for your projects:
102
+
103
+
```
104
+
npm i @angular-architects/native-federation
105
+
106
+
nx g @angular-architects/native-federation:init --project xyz --type remote --port 4201
107
+
```
108
+
109
+
**Remarks:** Use type `remote` or type `dynamic-host`.
110
+
111
+
3. Adjust your federation.config.js generated for Native Federation. You can mostly copy over the settings from your `webpack.config.js` used for Module Federation before.
112
+
113
+
4. Update your EcmaScript imports in your source code. Make sure, you import from `@angular-architects/native-federation` instead of from `@angular-architects/module-federation`. Please also note that the signature of `loadRemoteModule` has been simplified:
114
+
115
+
```typescript
116
+
// Before
117
+
import { loadRemoteModule } from '@angular-architects/module-federation';
Please also note that loadRemoteModule now always points to a logical name that is resolved via the shell's federation manifest (`src/assets/federation.manifest.json` or `public/federation.manifest.json`):
155
+
156
+
```json
157
+
{
158
+
"mfe1": "http://localhost:4201/remoteEntry.json"
159
+
}
160
+
```
161
+
162
+
Please also note that the remoteEntry is now a `.json` file.
163
+
164
+
5. If everything works, delete your `webpack.config.js`
165
+
166
+
## Module Federation Toolkit
167
+
168
+
For Module Federation, we offered a simple toolkit helping with Multi Version/ Multi Framework scenarios. However, this toolkit was quite simple and can be implemented with just a few lines of code. To give you more flexibility, instead of providing a respective package for Native Federation, [here](https://www.angulararchitects.io/blog/micro-frontends-with-modern-angular-part-2-multi-version-and-multi-framework-solutions-with-angular-elements-and-web-components/) we describe how to implement such a functionality by yourself.
169
+
19
170
## Issues
20
171
21
-
We have tested this guide with several projects. However, e
172
+
We have tested this guide with several projects. However, each project is different. If you run into issues, feel free to let us know.
0 commit comments