Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 680
Prateek Kumar Dalbehera Avatar asked Apr 08 '20 14:04

Prateek Kumar Dalbehera


2 Answers

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

like image 173
Robin Webb Avatar answered Oct 17 '22 09:10

Robin Webb


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\//,
        ]
      },
    },
};
like image 1
Julio Cesar Brito Gomes Avatar answered Oct 17 '22 07:10

Julio Cesar Brito Gomes