You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With MF 1.0, and using remoteEntry.js, i have the following code that initializes the remote container:
// Loads a remote entry script onto the page. Then initializes the remote container and any dependencies it requires.
async function getRemoteContainer<T extends Module>(
scope: string,
): Promise<WebpackContainer<T>> {
// check if container was already initialized
if (scope in containerCache) {
return containerCache[scope] as WebpackContainer<T>;
}
// Populates shared scope with known provided modules from this build and any loaded remotes
if (!shareScopeInitialized) {
// @ts-ignore
await __webpack_init_sharing__('default');
shareScopeInitialized = true;
}
// load remoteEntry file
await loadScript(url);
// load shared dependencies if not already provided
const container = (window as WindowWithContainers)[scope];
// @ts-ignore
await container.init(__webpack_share_scopes__.default);
containerCache[scope] = container;
window.dispatchEvent(new Event(LOAD_MFE_REMOTE_ENTRY_SCRIPT_SUCCESS));
return container as WebpackContainer<T>;
}
(Where url is the URL of the remoteEntry.js file of the remote)
However now, with MF 2.0, when i use mf-manifest.json instead of remoteEntry.js, the value of container is undefined.
What would be the required change to initialize the container when using MF 2.0?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
With MF 1.0, and using
remoteEntry.js
, i have the following code that initializes the remote container:(Where url is the URL of the
remoteEntry.js
file of the remote)However now, with MF 2.0, when i use
mf-manifest.json
instead ofremoteEntry.js
, the value ofcontainer
isundefined
.What would be the required change to initialize the container when using MF 2.0?
Beta Was this translation helpful? Give feedback.
All reactions