File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @module-federation/dts-plugin ' : patch
3
+ ' @module-federation/manifest ' : patch
4
+ ---
5
+
6
+ fix(dts-plugin): zipName should add prefix if remoteEntry has it
Original file line number Diff line number Diff line change @@ -33,13 +33,18 @@ export const validateOptions = (options: HostOptions) => {
33
33
} ;
34
34
35
35
export function retrieveTypesAssetsInfo ( options : RemoteOptions ) {
36
+ const { moduleFederationConfig } = options ;
36
37
let apiTypesPath = '' ;
37
38
let zipTypesPath = '' ;
39
+
40
+ let zipPrefix = '' ;
41
+
38
42
try {
39
43
const { tsConfig, remoteOptions, mapComponentsToExpose } =
40
44
retrieveRemoteConfig ( options ) ;
41
45
if ( ! Object . keys ( mapComponentsToExpose ) . length ) {
42
46
return {
47
+ zipPrefix,
43
48
apiTypesPath,
44
49
zipTypesPath,
45
50
zipName : '' ,
@@ -52,7 +57,22 @@ export function retrieveTypesAssetsInfo(options: RemoteOptions) {
52
57
apiTypesPath = retrieveMfAPITypesPath ( tsConfig , remoteOptions ) ;
53
58
}
54
59
60
+ if (
61
+ typeof moduleFederationConfig . manifest === 'object' &&
62
+ moduleFederationConfig . manifest . filePath
63
+ ) {
64
+ zipPrefix = moduleFederationConfig . manifest . filePath ;
65
+ } else if (
66
+ typeof moduleFederationConfig . manifest === 'object' &&
67
+ moduleFederationConfig . manifest . fileName
68
+ ) {
69
+ zipPrefix = path . dirname ( moduleFederationConfig . manifest . fileName ) ;
70
+ } else if ( moduleFederationConfig . filename ) {
71
+ zipPrefix = path . dirname ( moduleFederationConfig . filename ) ;
72
+ }
73
+
55
74
return {
75
+ zipPrefix,
56
76
apiTypesPath,
57
77
zipTypesPath,
58
78
zipName : path . basename ( zipTypesPath ) ,
@@ -61,6 +81,7 @@ export function retrieveTypesAssetsInfo(options: RemoteOptions) {
61
81
} catch ( err ) {
62
82
console . error ( ansiColors . red ( `Unable to compile federated types, ${ err } ` ) ) ;
63
83
return {
84
+ zipPrefix,
64
85
apiTypesPath : '' ,
65
86
zipTypesPath : '' ,
66
87
zipName : '' ,
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ export function getTypesMetaInfo(
297
297
return defaultTypesMetaInfo ;
298
298
}
299
299
300
- const { apiFileName, zipName } = retrieveTypesAssetsInfo ( {
300
+ const { apiFileName, zipName, zipPrefix } = retrieveTypesAssetsInfo ( {
301
301
...normalizedRemote ,
302
302
context,
303
303
moduleFederationConfig : pluginOptions ,
@@ -306,8 +306,8 @@ export function getTypesMetaInfo(
306
306
return {
307
307
path : '' ,
308
308
name : '' ,
309
- zip : zipName ,
310
- api : apiFileName ,
309
+ zip : path . join ( zipPrefix , zipName ) ,
310
+ api : path . join ( zipPrefix , apiFileName ) ,
311
311
} ;
312
312
} catch ( err ) {
313
313
console . warn (
You can’t perform that action at this time.
0 commit comments