Angular 10 - CommonJS 或 AMD 依赖项可能导致优化救助

2024-04-28

我已从 Angular 7.1.4 更新到 10。 现在我收到类似这样的奇怪警告:

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-dependencies https://angular.io/guide/build#configuring-commonjs-dependencies

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

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

如何解决与我的组件相关的此警告?


删除 TS 别名可能会起作用。

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

参考这个link https://github.com/angular/angular-cli/issues/18020了解更多

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Angular 10 - CommonJS 或 AMD 依赖项可能导致优化救助 的相关文章

随机推荐