@@ -179,8 +179,13 @@ module.exports = async function () {
179179
180180 await writeWebpackFederationEntryPoint ( mainFilePath ) ;
181181
182- let { remotes , shared } = getMergedConfig ( 'npmscripts' , 'federation ') ;
182+ const config = getMergedConfig ( 'npmscripts' ) ;
183183
184+ const { build, federation} = config ;
185+
186+ let { exposes, remotes, shared} = federation ;
187+
188+ exposes = exposes || [ ] ;
184189 remotes = remotes || [ ] ;
185190 shared = shared || [ ] ;
186191
@@ -220,6 +225,7 @@ module.exports = async function () {
220225 plugins : [
221226 new ModuleFederationPlugin ( {
222227 exposes : {
228+ ...prefixExposesPaths ( exposes , `./${ build . input } /` ) ,
223229 '.' : mainFilePath ,
224230 } ,
225231 filename : 'container.js' ,
@@ -256,3 +262,15 @@ module.exports = async function () {
256262 } ,
257263 } ;
258264} ;
265+
266+ function prefixExposesPaths ( exposes , prefix ) {
267+ return exposes . reduce ( ( exposes , filePath ) => {
268+ const exposeName = path . posix
269+ . relative ( '.' , filePath )
270+ . replace ( / \. j s $ / i, '' ) ;
271+
272+ exposes [ exposeName ] = `${ prefix } ${ filePath } ` ;
273+
274+ return exposes ;
275+ } , { } ) ;
276+ }
0 commit comments