Currently, I am developing an Angular library that consists of numerous modules and components. One essential feature is a plugin loading system.
The plugin loading mechanism functions under the assumption that the importing project (via npm) will have a "plugins" directory containing an "index.ts" file at its root. The plugin loading service then imports all the components exported by index.ts.
To achieve this, I am utilizing dynamic module importing syntax - specifically the async import('...')
statement. This approach works flawlessly when it targets a physically existing file. However, since the file isn't created during the compilation/publishing of my library but rather later within the user's project, adjustments need to be made.
My dilemma lies in figuring out how to persuade the Angular compiler to package the library without requiring the existence of the ../../plugins
module. Instead, I aim to fetch the plugins at runtime. Any suggestions on how to accomplish this seamlessly?