Module splitting
WebHare 5.4 now exposes esbuild's option to split the assetpack bundle and reduce initial load JS times
To enable this:
- remove
<assetpack>from the<webdesign>in your moduledefinition.xml - add an
assetPackto your moduledefinition.yml. Create if needed - add
module: trueto that assetpack
As an example:
assetPacks:
basetestjs:
entryPoint: webdesigns/basetestjs/frontend/frontend
supportedLanguages: [en, nl, ps]
module: true
Use wh apply assetpacks and republish your site to apply the change. A stub ap.js file will be created
that will simply load the module version of your assetpack to deal with pages that haven't been republished yet
Once the assetpack is published as a module, you can use import() to dynamically load modules.
Please note that splitting is still an experimental feature in esbuild. See also https://github.com/evanw/esbuild/issues/16