sourcemap-explorer 显示来自 @ng-bootstrap 的额外点点滴滴

sourcemap-explorer shows extra bits and pieces from @ng-bootstrap

我一直在使用一个名为 sourcemap-explorer 的工具,我注意到即使我只从 @ng-bootstrap/ng-bootstrap 导入 NgbDateParserFormatterNgbDatepickerModule,sourcemap-explorer 也会显示我得到了手风琴、旋转木马、标签集、弹出框、工具提示等。我认为导入单个模块的想法是为了避免占用整个包。还有其他人 运行 参与其中吗?

编辑 1: 这是我要导入的内容:

import { NgbDateParserFormatter, NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap';

这是我使用它的地方:

<input class="form-control" 
    placeholder="mm/dd/yyyy" 
    formControlName="effectiveDate"
    ngbDatepicker 
    #sd="ngbDatepicker">
<div class="input-group-addon" (click)="sd.toggle()">
    <i class="fa fa-calendar"></i>
</div>

根据您使用的打包器/捆绑器,如果您从包罗万象的模块路径 (@ng-bootstrap/ng-bootstrap) 导入,您最终可能会得到比所需代码更多的代码。

为了增加只使用代码的机会(最终结果 取决于所使用的捆绑器)尝试从特定于日期选择器的模块路径导入:import { NgbDateParserFormatter, NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap/datepicker/datepicker.module';

以上内容应该可以与 angular-cli 一起正常工作。