Module Federation in Plone
Module Federation is a JavaScript technology based on webpack that handles dependency resolution and the loading/importing of modules, even if they come from external, remote bundles.
A bundle is a set of JavaScript modules which
provides some functionality and can be run on its own.
A typical web project often includes multiple
bundles to provide all the necessary JavaScript
functionality.
In Plone, Module Federation
helps us to prevent loading the same dependencies multiple
times.
Think of a Plone add-on with a JavaScript bundle
which uses Leaflet, Select2 and jQuery. Those dependencies
are also used by the Plone core JavaScript bundle "Mockup"
and other add-ons. These dependencies can - and should -
be shared among the different bundles.
This
talk explains the concepts behind Module Federation and
how we use it in Plone to optimize loading speed.