I have encountered an issue with my Angular application.
My goal is to create an Angular application written in TypeScript and built with (aot).
The objective is to create a user dashboard with various widgets, each widget being an Angular component.
While my app already includes some widgets, I want to be able to extend them through a marketplace or manual creation.
The marketplace should be able to download files (js/ts/bundle..??) into a designated folder.
Subsequently, my app should be capable of loading and instantiating these new widgets (= ng component).
This is the folder structure in production:
|- index.html
|- main.f5b448e73f5a1f3f796e.bundle.js
|- main.f5b448e73f5a1f3f796e.bundle.js.map
|- .... (all other generated files)
|- externalWidgets
|- widgetA
|- widjetA.js
|- widjetA.js.map
|- assets
|- image.png
|- widgetB
|- widjetB.ts
|- widjetB.html
|- widjetB.css
When loading the user page, the database indicates the presence of widgetA. Therefore, the objective is to dynamically load files and instantiate the included component.
I have attempted different solutions, such as using "require" and "System.import," but they have both failed when the path needs to be dynamically generated.
Is it possible to achieve this? I am open to changing my code structure and modifying external widgets (for instance, widgetB has not been transpiled yet...).
In essence, I am seeking a "plugin system" for an Angular4/webpack application.