Why forRoot method will be remove from all module in 4.0

forRoot function is useful in lazy load Angular application.
e.g. if I import NgbModalModule in appModule and lazyLoadModule(lazy load for some path), this will inject two instance of “NgbModal” service for root module and lazyLoadModule.

may be, There is no problem if you add forChild(without providers) and remove forRoot.
I want only one instance of service through out application(including lazyload modules).

1 possible answer(s) on “Why forRoot method will be remove from all module in 4.0

  1. @pkozlowski-opensource does this mean that importing NgbModalModule into both AppModule and LazyModule will cause it to jump from 10kb (modal) to 50kb (entire lib)?

    I’m seeing it happen here when trying to debug why my app grows every version of Angular. Currently I’ve got a reproduction for NGB

    Here’s what causes it to jump from 10 -> 50kb: https://github.com/intellix/ng7-treeshake-break/blob/master/src/app/lazy/lazy.module.ts#L14

    Same thing in AppModule: https://github.com/intellix/ng7-treeshake-break/blob/master/src/app/app.module.ts#L20

    I’ve really no idea how Lazy modules are meant to use Modals without pulling in the whole library