I'm lazy loading some of my feature modules in an Angular 6 application. Some of those feature modules have dependencies on JS libraries, which no other modules use, and some which are shared between lazy loaded modules.
At the moment, I'm including those libraries in the angular.json configuration in the scripts
array, but that means that all those libraries are eager-loaded with the rest of the application, even though they are only used by the lazy loaded module(s).
Is there a way to lazy load JS libraries with the lazy loaded modules? I'd rather not lazy load it within a component (see How to load external scripts dynamically in Angular?) as this would mean copying the import across components within the module, I'm wondering if this can be done across a module.