6

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?

JSON Derulo
  • 9,780
  • 7
  • 39
  • 56

1 Answers1

5

Removing TS alias might work.

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

Refer this link for more

Arun Kumar
  • 1,449
  • 1
  • 17
  • 33
  • Hi Arun, the import in MeseComponent is defined like this: import { CalendarComponent } from 'src/app/interfaces/calendar/calendar.component'; This definition is the same in all my project. VsCode declare it like this by default, i don't think this is the problem. – Alessandro Perfetti Jun 26 '20 at 12:09
  • 1
    I had similar warnings when switching to Angular 10, and while this worked for me as well, I wish I knew why. It seems like a bug if just "finding the module a different way" removes the warning. – MotoRidingMelon Aug 15 '20 at 23:21
  • For some reason this has worked for me and fixed my issue – O.MeeKoh Sep 08 '21 at 17:24