angularprimengangular10

Angular - primeng CommonJS or AMD dependencies can cause optimization bailouts


I got a little Angular app, in which I'm using PrimeNG components. Since I did the Angular 10 update I get the following Warning:

CommonJS or AMD dependencies can cause optimization bailouts.

for different PirmeNg-components.

I already tried this:

"allowedCommonJsDependencies": [
              "loadsh",
              "primeng/primeng",
              "primeicons",

This is suggested on the offical homepage

Another try I did is checking the imports like mentioned in this post

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

But as I don't have any imports with "@" on the beginning I'm wondering how this warning could be fixed or suppressed?

EDIT:

Error in detail:

WARNING in 'path' depends on 'chartjs'. CommonJS or AMD dependencies can cause optimization bailouts.


Solution

  • In angular.json add

     "build": {
              "builder": "@angular-devkit/build-angular:browser",
              "options": {
                "allowedCommonJsDependencies": ["chart.js"],