Angular 10 - CommonJS or AMD dependencies can cause optimization bailouts

孤人 提交于 2020-08-26 10:00:08

问题


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

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

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?


回答1:


Removing TS alias might work.

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

Refer this link for more



来源:https://stackoverflow.com/questions/62593028/angular-10-commonjs-or-amd-dependencies-can-cause-optimization-bailouts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!