File tree Expand file tree Collapse file tree 5 files changed +20
-3
lines changed
libs/nx-angular-mf/src/builders Expand file tree Collapse file tree 5 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 15
15
" @angular/animations/browser/testing" ,
16
16
" @angular/common/http/testing" ,
17
17
" @angular/common/testing" ,
18
+ " @angular/common/upgrade" ,
18
19
" @angular/core/testing" ,
19
20
" @angular/ssr/node" ,
20
21
" rxjs/testing" ,
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export async function prepareConfig(
20
20
const remoteEntry : ConfigMf [ 'remoteEntry' ] = defaultOptions . remoteEntry || { } ;
21
21
const exposes : ConfigMf [ 'exposes' ] = { } ;
22
22
23
+ let deployUrl = '' ;
23
24
let indexHtmlTransformer = ( input : string ) => Promise . resolve ( input ) ;
24
25
25
26
if ( defaultOptions . skipList ) {
@@ -64,6 +65,10 @@ export async function prepareConfig(
64
65
}
65
66
}
66
67
68
+ if ( buildOptions . deployUrl ) {
69
+ deployUrl = buildOptions . deployUrl ;
70
+ }
71
+
67
72
return {
68
73
skipList : skipList ,
69
74
externalList : externalList ,
@@ -76,7 +81,8 @@ export async function prepareConfig(
76
81
allImportMap : { } ,
77
82
indexHtmlTransformer,
78
83
remoteEntry,
79
- exposes
84
+ exposes,
85
+ deployUrl
80
86
} ;
81
87
}
82
88
Original file line number Diff line number Diff line change @@ -49,9 +49,10 @@ export function getDataForImportMap(
49
49
const mapShareObject = getMapName ( mfeConfig . shared , mfeConfig . sharedMappings ) ;
50
50
return {
51
51
imports : [ ...mapShareObject . entries ( ) ] . reduce ( ( acum , [ key , val ] ) => {
52
+ const resultName =
53
+ mfeConfig . outPutFileNames . find ( ( i ) => i . startsWith ( key ) ) || key + '.js' ;
52
54
53
- acum [ val . packageName ] = `./${ key } .js` ;
54
-
55
+ acum [ val . packageName ] = `${ mfeConfig . deployUrl } ${ resultName } ` ;
55
56
return acum ;
56
57
} , { } ) ,
57
58
exposes : Object . entries ( mfeConfig . exposes ) . reduce ( ( acum , [ key , val ] ) => {
Original file line number Diff line number Diff line change @@ -62,6 +62,14 @@ export async function* runBuilder(
62
62
context
63
63
) ;
64
64
65
+ if ( ! optionsMfe . deployUrl ) {
66
+ const deployUrl = new URL ( 'http://localhost' ) ;
67
+ deployUrl . port = options . port . toString ( ) ;
68
+ deployUrl . hostname = options . host ;
69
+ deployUrl . protocol = options . ssl ? 'https' : 'http' ;
70
+ optionsMfe . deployUrl = deployUrl . toString ( ) ;
71
+ }
72
+
65
73
const mapShareObject = getMapName (
66
74
optionsMfe . shared ,
67
75
optionsMfe . sharedMappings
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export type ConfigMf = {
5
5
sharedMappings : { key : string ; path : string } [ ] ;
6
6
outPutFileNames : string [ ] ;
7
7
esPlugins : string [ ] ;
8
+ deployUrl : string ;
8
9
allImportMap : Record < string , unknown > ;
9
10
indexHtmlTransformer : ( input : string ) => Promise < string > ;
10
11
exposes : Record < string , string > ;
You can’t perform that action at this time.
0 commit comments