从模块执行模块或库时如何处理 Angular 警告“花费的时间超过 2417 毫秒”?

问题描述 投票:0回答:0

我刚刚将 Angular Cli 升级到 16.0.1,将 Node 升级到 18.16.0,现在我在我的 Angular 应用程序中点击不同的页面时看到了警告。

警告信息:

警告:处理 https://localhost:4200/default-src_app_shared_models_countries_ts-node_modules_ngx-bootstrap_sortable_fesm2020_ngx-b-2e9b69.js 的源映射花费的时间超过 2417.002833000001 毫秒,因此我们继续执行而不等待脚本的所有断点被设置.

我猜这个警告有两个问题,第一个是我共享模块中的 countries.ts,我将在下面发布。它有完整的国家列表及其国家代码,所以它很长,第二个是 ngx-bootstrap 库,我在我的应用程序的几个不同模块中引用了它。

它说加载需要很长时间(> 2000ms)

问题 - 我该怎么办?

很难想象这两个会花那么长时间,但不确定幕后发生了什么。

countries.ts 看起来像这样:

// full list not shown 
export class Countries {
  countryCode = [{
      name: 'Afghanistan',
      code: 'AF'
    },
    {
      name: 'land Islands',
      code: 'AX'
    },
    {
      name: 'Albania',
      code: 'AL'
    },
    ...
  ];
}

// refernce it like this in a class
countryList = new Countries().countryCode;

在我的 account.module.ts 文件中,我引用了 ngx-bootstrap 排序方式,如下所示:

import { SortableModule } from 'ngx-bootstrap/sortable';

imports: [
    CommonModule,
    SharedModule,
    AccountRoutingModule,
    ModalModule.forRoot(),
    SortableModule.forRoot(),
    ...
  ],

angular angular-cli warnings ngx-bootstrap angular-module
© www.soinside.com 2019 - 2024. All rights reserved.