File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ const isMfeHost = mfeRole === 'host'
2828const isMfeRemote = mfeRole === 'remote'
2929const isMfeEnabled = isMfeHost || isMfeRemote
3030
31+ const mfeName = isMfeEnabled ? toMfeName ( paths . projectName ) : undefined
32+
3133const toMfeName = ( name ) => {
3234 const raw = ( name || '' ) . toString ( ) . trim ( ) || 'app'
3335 const safe = raw . replace ( / [ ^ a - z A - Z 0 - 9 _ ] / g, '_' )
@@ -130,6 +132,9 @@ const config = {
130132 asyncFunction : true ,
131133 } ,
132134 uniqueName : isMfeEnabled ? toMfeName ( paths . projectName ) : undefined ,
135+ // For MF remotes in production we must expose the container globally so the host can find it.
136+ // Using a string-keyed window export avoids minifier renaming issues.
137+ library : isMfeRemote && mfeName ? { type : 'window' , name : mfeName } : undefined ,
133138 filename : isDev ? 'static/js/[name].js' : 'static/js/[name].[contenthash].js' ,
134139 chunkFilename : isDev ? 'static/js/[name].js' : 'static/js/[name].[contenthash].js' ,
135140 // library: '',
You can’t perform that action at this time.
0 commit comments