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

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

问题描述

我已经从 angular 7.1.4 更新到了 10.现在我收到这样的奇怪警告:

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

C:SviluppoWelcomewelcome-cloud-appsrcappcalendario-fascemesemese.component.ts 中的警告取决于 src/app/interfaces/calendar/calendar.component.CommonJS 或 AMD 依赖项可能会导致优化救助.有关更多信息,请参阅:https://angular.io/guide/build#configuring-commonjs-依赖

WARNING in C:SviluppoWelcomewelcome-cloud-appsrcappcalendario-fascemesemese.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天全站免登陆