import 'library';
import * as library from 'library';
import library from library;
import {method} from library;
Webpack Bundle Analyzer
Source Map Explorer
const toastrFactory = () => import('toastr').then(p => p.default);
type LazyToastr = ReturnType<typeof toastrFactory>;
const TOASTR = new InjectionToken<LazyToastr>('Lazily loaded toastr', {
providedIn: 'root',
factory: toastrFactory
});
Полный пример тут
Guess JS