Angular 10-CommonJS或AMD依赖项可能会导致优化援助 [英] Angular 10 - CommonJS or AMD dependencies can cause optimization bailouts

查看:909
本文介绍了Angular 10-CommonJS或AMD依赖项可能会导致优化援助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将角度从7.1.4更新为10. 现在我收到像这样的奇怪警告:

I've updated from angular 7.1.4 to 10. Now i receive strange warnings like this one:

C:\ Sviluppo \ Welcome \ welcome-cloud-app \ src \ app \ calendario-fasce \ mese \ mese.component.ts中的警告取决于src/app/interfaces/calendar/calendar.component. CommonJS或AMD依赖项可能会导致优化援助. 有关更多信息,请参见: https://angular.io/guide/build#configuring-commonjs -依赖项

WARNING in C:\Sviluppo\Welcome\welcome-cloud-app\src\app\calendario-fasce\mese\mese.component.ts depends on src/app/interfaces/calendar/calendar.component. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

对于类似这样的其他警告,我在angular.json中添加了相对行,例如:

For other warnings like this, i've added in angular.json the relative line, for example:

"allowedCommonJsDependencies": [
    "moment",
    ....
]"

我该如何解决与组件有关的警告?

How can i resolve this warning relative to my components?

推荐答案

删除TS别名可能有用.

Removing TS alias might work.

import { x } from '@auth/auth....'           // Warning
...to...
import { x } from '../auth/...'              // Warning goes away

请参见链接以获取更多信息

这篇关于Angular 10-CommonJS或AMD依赖项可能会导致优化援助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆