Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 10 - CommonJS or AMD dependencies can cause optimization bailouts

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?

like image 268
Alessandro Perfetti Avatar asked Jun 26 '20 10:06

Alessandro Perfetti


1 Answers

Removing TS alias might work.

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

Refer this link for more

like image 104
Arun Kumar Avatar answered Sep 27 '22 21:09

Arun Kumar