'Angular - Warning: Entry point '@libray-package' contains deep imports into 'module/file'

After upgrading the project to Angular 9.1, the CLI is throwing multiple warnings for various libraries like below:

Warning: Entry point '@azure/msal-angular' contains deep imports into 'node_modules/msal/lib-commonjs/utils/UrlUtils'. This is probably not a problem, but may cause the compilation of entry points to be out of order.

Warning: Entry point 'ngx-toastr' contains deep imports into 'node_modules/@angular/compiler/src/core'. This is probably not a problem, but may cause the compilation of entry points to be out of order.

I search for this warning and got this Github issue: https://github.com/angular/angular/issues/35615

This slilences the warning. But what is the root cause of this warning and how to fix it instead of just supressing the warning?



Solution 1:[1]

Not sure if this will help you, but I solved the same "ngx-toastr" warning message by installing the latest version from https://www.npmjs.com/package/ngx-toastr/v/12.0.1

Perhaps the older version(s) of "ngx-toastr" aren't compatible with Angular CLI 9.1 ?

This is the relevant section of my package.json post update.

.
.
.
 "ngx-toastr": "^12.0.1",
.
.
.

Perhaps "@azure/msal-angular" can be resolved in the same way (although I haven't used this package).

Good Luck!

Robin

Solution 2:[2]

In this github topic it is informed that it may be a false positive. To solve this problem, it is necessary to create a file with the name ngcc.config.js in the root of the project and in this structure, inform the folders to be ignored.

In my case the false positive pointed to the lib "angular2-text-mask".

module.exports = {
    packages: {
      'angular2-text-mask': {
        ignorableDeepImportMatchers: [
          /text-mask-core\//,
        ]
      },
    },
};

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robin Webb
Solution 2 Julio Cesar Brito Gomes