I am working on an Angular library with a lot of modules and components, one of them being a plugin loading system.
The way the plugin loading system works is based on the assumption that the project which imports it (via npm) will contain a "plugins" directory with an "index.ts" file in its root and the plugin loading service will import whatever components are exported by index.ts.
I am using the dynamic module importing syntax - the async import('...')
statement, which works perfectly when it's pointing to a file which physically exists there, but such a file won't exist at the time when I'm compiling/publishing my library, it exists only at a later stage, inside the project that uses it.
How can I 'trick' the Angular compiler to package the library without the existence of a ../../plugins
module and instead fetch the plugins at runtime?