The below video show’s a demo of how dynamic import with AEM Components would work
Prepare ui.frontend module for Dynamic Imports
The AEM Archetype has an option to generate a ui.frontend module with a dedicated front-end build mechanism based on Webpack to keep front-end resources separate. This below instructions assume you have generated the ui.frontend module as part of your AEM project generation using archetype.
Step 1: Update the clientlib.config.js
We have updated the clientlib.config.js to create a new clientlibrary named clientlib-dynamic-modules for storing shared module files inside /resources folder.
The clientlibrary node module will generate a new clientlib based on this configuration and copy the chunks from dist/clientlib-site-shared-modules/resources into this clientlibrary’s resources folder.