Angular - 警告:入口点“@libray-package”包含对 'module/file' 的深度导入
Angular - Warning: Entry point '@libray-package' contains deep imports into 'module/file'
将项目升级到 Angular 9.1 后,CLI 为各种库抛出多个警告,如下所示:
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.
我搜索此警告并得到此 Github 问题:https://github.com/angular/angular/issues/35615
这会消除警告。但是这个警告的根本原因是什么以及如何解决它而不是仅仅抑制警告?
不确定这是否对您有帮助,但我通过安装来自 https://www.npmjs.com/package/ngx-toastr/v/12.0.1
的最新版本解决了相同的 "ngx-toastr" 警告消息
也许 "ngx-toastr" 的旧版本与 Angular CLI 9.1 不兼容?
这是我的 package.json post 更新的相关部分。
.
.
.
"ngx-toastr": "^12.0.1",
.
.
.
也许“@azure/msal-angular”可以用同样的方法解决(虽然我没用过这个包)
祝你好运!
罗宾
在此github topic告知可能是误报。要解决此问题,需要在项目的根目录中创建一个名为 ngcc.config.js 的文件,并在此结构中通知要忽略的文件夹。
在我的例子中,误报指向库“angular2-text-mask”。
module.exports = {
packages: {
'angular2-text-mask': {
ignorableDeepImportMatchers: [
/text-mask-core\//,
]
},
},
};
将项目升级到 Angular 9.1 后,CLI 为各种库抛出多个警告,如下所示:
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.
我搜索此警告并得到此 Github 问题:https://github.com/angular/angular/issues/35615
这会消除警告。但是这个警告的根本原因是什么以及如何解决它而不是仅仅抑制警告?
不确定这是否对您有帮助,但我通过安装来自 https://www.npmjs.com/package/ngx-toastr/v/12.0.1
的最新版本解决了相同的 "ngx-toastr" 警告消息也许 "ngx-toastr" 的旧版本与 Angular CLI 9.1 不兼容?
这是我的 package.json post 更新的相关部分。
.
.
.
"ngx-toastr": "^12.0.1",
.
.
.
也许“@azure/msal-angular”可以用同样的方法解决(虽然我没用过这个包)
祝你好运!
罗宾
在此github topic告知可能是误报。要解决此问题,需要在项目的根目录中创建一个名为 ngcc.config.js 的文件,并在此结构中通知要忽略的文件夹。
在我的例子中,误报指向库“angular2-text-mask”。
module.exports = {
packages: {
'angular2-text-mask': {
ignorableDeepImportMatchers: [
/text-mask-core\//,
]
},
},
};