I am developing a SPA which contains multiple dashboards. Each dashboard is a set of Web Components respecting a layout. These components are not known statically. They are determined at run-time.
What I want to achieve is the following scenario:
- Application starts.
- The application performs XHR to fetch dashboards representations from a REST service.
- User sees dashboards listed by name.
- User clicks on a dashboard item. (say dashboard 1)
- The application determines the necessary components needed to load dashboard 1 (web components)
- Load web components and their dependencies.
I am pretty aware of loading web components dynamically which was answered here
My actual problem is
how to load a web component with their dependencies at run-time without having to load duplicate dependencies?
Are there any module formats or practices to follow when packaging the web components?