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
2.``ng g @angular-architects/module-federation:init``
87
+
3. Adjust the generated ``webpack.config.js`` file
88
+
4. Repeat this for further projects in your workspace (if needed)
89
+
71
90
## Getting Started 🧪
72
91
73
92
Please find here a [tutorial](https://github.com/angular-architects/module-federation-plugin/blob/12.0.0/libs/mf/tutorial/tutorial.md) that shows how to use this plugin.
Copy file name to clipboardExpand all lines: migration-guide.md
+36-26Lines changed: 36 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Migration Guide for Angular 13
2
2
3
-
Beginning with version 13, the Angular CLI compiles bundles as EcmaScript modules. This also effects how entry points for Module Federation are generated. This guide shows how you can adjust to this.
3
+
Beginning with version 13, the Angular CLI compiles emits EcmaScript modules. This also effects how entry points for Module Federation are generated. This guide shows how you can adjust to this.
4
4
5
5
## Big Thanks
6
6
@@ -10,41 +10,35 @@ Big thanks to all the people, that helped with this migration:
As long as the CLI doesn't support webpack 5.64.4 or higher, we need to force it into this version. It seems like that this is necessary for CLI 13.0.x, while 13.1.x and above will ship with a fitting webpack version. In the latter case, you can skip this section. Otherwise, add this section to your ``package.json``:
21
+
## Upgrade to Angular and Angular CLI 13.1 (!) or higher
18
22
19
-
```diff
20
-
+ "resolutions": {
21
-
+ "webpack": "5.64.4"
22
-
+ },
23
-
```
23
+
As we need a newer webpack version, don't go with Angular 13.0 but with 13.1 or higher.
24
24
25
-
Then, nuke your ``node_modules`` folder and install the dependencies with ``yarn`` (!). Please note, that yarn is needed for respecting the ``resolutions`` section. Once, the CLI ships with a fitting webpack version you can git rid of this section and use other package manager.
25
+
## Update your Compilation Target
26
26
27
-
If you haven't created your project with yarn, also add the following section to your ``angular.json``:
27
+
In your ``tsconfig.json`` or ``tsconfig.base.json``, make sure, your compilation ``target`` is ``es2020`` or higher:
Add the following setting to all your webpack configs:
@@ -134,9 +128,25 @@ To prevent issues with live reloads, you need to add a ``publicHost`` property t
134
128
[...]
135
129
```
136
130
137
-
### Advanced: Loading Script-based Remotes
131
+
### Advanced: Dynamic Federation with Script-based Remotes
132
+
133
+
If you also want to load (existing) script-based remotes into your shell, e. g. remotes built with Angular 12 used for a [Multi-Version/Multi-Framework setup](https://www.npmjs.com/package/@angular-architects/module-federation-tools), you can pass ``type: 'script'`` to both, ``loadRemoteModule`` and ``loadRemoteEntry``. In this case, you also need to pass a ``remoteName``.
138
134
139
-
If you also want to load script-based remotes into your shell, e. g. remotes build with Angular 12 used for a [Multi-Version/Multi-Framework setup](https://www.npmjs.com/package/@angular-architects/module-federation-tools), you can pass ``type: 'script'`` to both, ``loadRemoteModule`` and ``loadRemoteEntry``. In this case, you also need to pass a ``remoteName``.
135
+
### Advanced: Static Federation with Script-based Remotes
136
+
137
+
If you want to load (existing) script-based remote into your shell, e. g. such built with Angular 12, you can use the following syntax in the shell's ``webpack.config.js``.
138
+
139
+
In the following example, ``mfe1`` is loaded as a module while ``mfe2`` is loaded as a script:
0 commit comments