Skip to content

Commit f561c90

Browse files
committed
wip3 for multi-version-ng code demo
1 parent 0c328ad commit f561c90

16 files changed

+42
-84
lines changed

code-demos/multi-version-ng/README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ code-demos\multi-version-ng\mfe3-ng12\tsconfig.json -> resolveJsonModule and all
1414
webpack.config.js files -> talk about the diffs, different ng versions have differnt setups. More importantly is the share bit
1515

1616

17-
code-demos\multi-version-ng\mfe3-ng12\package.json -> start:local-web-component
17+
code-demos\multi-version-ng\mfe3-ng12\package.json -> "start:mfe": "ng serve --configuration mfe"
18+
19+
20+
code-demos\multi-version-ng\mfe3-ng12\src\bootstrap.ts -> talk about bootstrapModule
1821

1922

2023
code-demos\multi-version-ng\mfe3-ng12\src\app\my-feature\remote-bootstrap.ts -> bootstrapMyComponentAsyncV2
@@ -40,4 +43,8 @@ code-demos\multi-version-ng\mfe3-ng12\src\app\app.module.ts
4043
// Because of this we don't add anything to the boostrap array and we do some logic in the ngDoBootstrap function which gets called if the bootstrap array is empty (check this, link to article).
4144

4245

43-
Maybe change the ngDoBootstrap signature to take in the appref? What makes more sense? check docs on bgDoBootstrap overloads?
46+
Maybe change the ngDoBootstrap signature to take in the appref? What makes more sense? check docs on bgDoBootstrap overloads?
47+
48+
49+
add note about using `npm i -D @angular-architects/module-federation-tools@appropriate-version`: "@angular-architects/module-federation-tools": "^16.0.4",
50+
instead of the custom platform bootstrap, note that the same custom platform bootstrap is used on the remote bootstrap file

code-demos/multi-version-ng/mfe1-ng16/package-lock.json

-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code-demos/multi-version-ng/mfe1-ng16/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
},
2121
"devDependencies": {
2222
"@angular-architects/module-federation": "^16.0.4",
23-
"@angular-architects/module-federation-tools": "^16.0.4",
2423
"@angular-devkit/build-angular": "^16.1.4",
2524
"@angular/cli": "~16.1.4",
2625
"@angular/compiler-cli": "^16.1.0",

code-demos/multi-version-ng/mfe2-ng14/package-lock.json

-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code-demos/multi-version-ng/mfe2-ng14/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
},
2121
"devDependencies": {
2222
"@angular-architects/module-federation": "^14.0.0",
23-
"@angular-architects/module-federation-tools": "^16.0.4",
2423
"@angular-devkit/build-angular": "^14.2.12",
2524
"@angular/cli": "~14.2.12",
2625
"@angular/compiler-cli": "^14.2.0",

code-demos/multi-version-ng/mfe3-ng12/angular.json

+17
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@
5858
"extractLicenses": false,
5959
"sourceMap": true,
6060
"namedChunks": true
61+
},
62+
"mfe": {
63+
"buildOptimizer": false,
64+
"optimization": false,
65+
"vendorChunk": true,
66+
"extractLicenses": false,
67+
"sourceMap": true,
68+
"namedChunks": true,
69+
"fileReplacements": [
70+
{
71+
"replace": "src/environments/environment.ts",
72+
"with": "src/environments/environment.mfe.ts"
73+
}
74+
]
6175
}
6276
},
6377
"defaultConfiguration": "production"
@@ -71,6 +85,9 @@
7185
},
7286
"development": {
7387
"browserTarget": "mfe3-ng12:build:development"
88+
},
89+
"mfe": {
90+
"browserTarget": "mfe3-ng12:build:mfe"
7491
}
7592
},
7693
"defaultConfiguration": "development",

code-demos/multi-version-ng/mfe3-ng12/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "mfe3-ng12",
33
"version": "0.0.0",
44
"scripts": {
5-
"start": "ng serve"
5+
"start": "ng serve",
6+
"start:mfe": "ng serve --configuration mfe"
67
},
78
"private": true,
89
"dependencies": {

code-demos/multi-version-ng/mfe3-ng12/src/bootstrap.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ import { enableProdMode } from '@angular/core';
22
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
33
import { environment } from './environments/environment';
44
import { DevPlatformModule } from './dev-platform/dev-platform.module';
5+
import { MfePlatformModule } from './mfe-platform/mfe-platform.module';
56

67
if (environment.production) {
78
enableProdMode();
89
}
910

11+
const bootstrapModule = environment.runMfePlatform
12+
? MfePlatformModule
13+
: DevPlatformModule;
14+
1015
platformBrowserDynamic()
11-
.bootstrapModule(DevPlatformModule)
16+
.bootstrapModule(bootstrapModule)
1217
.catch((err) => console.error(err));
1318

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export const environment = {
22
production: false,
3-
bootstrapWebComponent: true,
3+
runMfePlatform: true,
44
};
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const environment = {
2-
production: true
2+
production: true,
3+
runMfePlatform: false,
34
};

code-demos/multi-version-ng/mfe3-ng12/src/environments/environment.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
// The list of file replacements can be found in `angular.json`.
44

55
export const environment = {
6-
production: false
6+
production: false,
7+
runMfePlatform: false,
78
};
89

910
/*

code-demos/multi-version-ng/mfe3-ng12/src/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<link rel="icon" type="image/x-icon" href="favicon.ico">
99
</head>
1010
<body>
11-
<app-root></app-root>
12-
<mfe3-element></mfe3-element>
11+
<app-root></app-root> <!-- this is the root element used by the DevPlatformModule -->
12+
<mfe3-element></mfe3-element> <!-- this is the root element used by the MfePlatformModule -->
1313
</body>
1414
</html>

code-demos/multi-version-ng/shell-ng16/angular.json

+1-7
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,7 @@
4747
"vendorChunk": true,
4848
"extractLicenses": false,
4949
"sourceMap": true,
50-
"namedChunks": true,
51-
"fileReplacements": [
52-
{
53-
"replace": "src/environments/environment.ts",
54-
"with": "src/environments/environment.development.ts"
55-
}
56-
]
50+
"namedChunks": true
5751
}
5852
},
5953
"defaultConfiguration": "production"

code-demos/multi-version-ng/shell-ng16/package-lock.json

-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code-demos/multi-version-ng/shell-ng16/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
},
2121
"devDependencies": {
2222
"@angular-architects/module-federation": "^16.0.4",
23-
"@angular-architects/module-federation-tools": "^16.0.4",
2423
"@angular-devkit/build-angular": "^16.1.4",
2524
"@angular/cli": "~16.1.4",
2625
"@angular/compiler-cli": "^16.1.0",

code-demos/multi-version-ng/shell-ng16/src/bootstrap.ts

-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { PlatformRef } from '@angular/core';
22
import { AppModule } from './app/app.module';
3-
// import { environment } from './environments/environment';
4-
// import {
5-
// Options,
6-
// bootstrap,
7-
// } from '@angular-architects/module-federation-tools';
83
import { platformBrowser } from '@angular/platform-browser';
94
import packageJson from '../package.json';
105
// import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
@@ -13,12 +8,6 @@ import packageJson from '../package.json';
138
// .bootstrapModule(AppModule)
149
// .catch((err) => console.error(err));
1510

16-
// const bootstrapOptions: Options = {
17-
// production: environment.production,
18-
// appType: "shell",
19-
// };
20-
// bootstrap(AppModule, bootstrapOptions)
21-
2211
const platform = getAngularPlatform();
2312
platform.bootstrapModule(AppModule);
2413

0 commit comments

Comments
 (0)