The experiments
configuration is used to enable experimental capabilities in the plugin.
enum
false
false | "hoisted"
Hoisted
RuntimeWhen the runtime is hoisted
, the following occurs:
These configurations are useful for:
runtimeChunk: 'single'
.import()
at the top of the app or in the entry point of user code to prevent eager consumption errors. In the past, this was often mandatory and commonly seen as import('./bootstrap.js')
in example apps.The module-federation/runtime
is patched onto entrypoints. This causes multiple copies to exist in some builds.
It also causes some "eager consumption" errors when chunk splitting is configured in certain ways.
This resolves a common issue with runtimeChunk: single
This mode allows for async startup. When exporting a UMD library, it can return a promise resolving to the export.
If you manually require() an entrypoint in Node, it sets module.exports to Promise.resolve(exports).
Entrypoint startup will switch to "active" initialization and use async dependency startup.
You will no longer need a mandatory import('./bootsrtap')
dynamic import in order for consumers / hosts to function.
There should be no "eager consumption" errors possible, as the initialization of the files themselves behave as async chunks.
Instead of federation runtime initilizing in the entrypoint code, it is initialized in a RuntimeModule, within the webpack runtime. This allows module federation to be avaliable ahead of time, thus enabling "Async Startup" capabilities etc.