I tried this out and discovered that it is not allowed to "bubble up" providers from 3rd-party library in your own library and then import your own library into an application. The approach I tried was to write a forRoot() function in the shared library that in-turn called LoggerModule.forRoot():
static forRoot(config: LoggerConfig): any[] {
return [
MyCoreModule,
LoggerModule.forRoot(config),
];
}
The compiler reports an error saying that the forRoot() function could not be statically evaluated. So... I guess the answer to my original question is: No, you should not try and bubble-up the providers from a 3rd Party library. Instead, the application module should import the 3rd-party module directly. In my case that is:
imports: [
LoggerModule.forRoot({
level: NgxLoggerLevel.DEBUG,
}),
]
The original goal was to hide the 3rd-party libs & modules inside one "core" library was to create a sort of "platform" library. But that has its own drawbacks.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…