Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When we navigate to that route, we need to load the ProfilePage module from the frontend-app-profile MFE. The shell will need module federation configuration that describes where to find this module. The element of the Route will be a React Suspense component that waits for module federation to load and supply ProfilePage and fulfill the Suspense’s promise.

Shared Dependency Resolution

Shared dependencies (React, Paragon, frontend-platform, etc.) are resolved at runtime based on the version requirements of modules. Webpack module federation handles this, we don’t have to write this code ourselves. Broadly, if a compatible version (according to semantic versioning) of a shared dependency already exists on the page, a module will use that. If a compatible version doesn’t exist, the module will fall back to the version bundled with its own MFE, which was also deployed. If a compatible versions exist in general, MFEs will never need to fall back to their own version, meaning end users download less code.

There’s a special case around “singleton” shared dependencies, such as React and frontend-platform. Singletons are denoted by a singleton: true flag in the ModuleFederationPlugin config, and are useful when a dependency only functions properly when there’s one version of it on a page. React throws warnings and doesn’t work correctly if there are two versions of it on the page, and frontend-platform similarly doesn’t work properly if it’s loaded more than once.

Default Modules

Default modules aren’t represented on the diagram above, but are an important part of the architecture. An unmodified release of the Open edX Platform will by default include a number of core MFEs and components such as the brand, header, and footer. It will also include default frontend-platform service implementations for logging and analytics.

Minimally, operators will want to override the brand, header and footer. More adventurous operators may wish to replace entire MFEs, or use different MFEs for different users based on runtime configuration.

The shell application should include a default set of MFEs which functions with zero custom configuration. Operators should be able to easily override some or all of that default configuration.