angularngx-charts

rfdc'. CommonJS or AMD dependencies can cause optimization bailouts ANGULAR PROJECT with ngx-charts lib


I have à problem with my Angular Project :

when i build my app i have this error log :

"Warning: C:\--------------------------------------------------testcode\node_modules\@swimlane\ngx-charts\fesm2020\swimlane-ngx-charts.mjs depends on 'rfdc'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
"

and thats my list of lib :

├── @angular-devkit/build-angular@15.2.11
├── @angular/animations@15.2.10
├── @angular/cli@15.2.11
├── @angular/common@15.2.10
├── @angular/compiler-cli@15.2.10
├── @angular/compiler@15.2.10
├── @angular/core@15.2.10
├── @angular/forms@15.2.10
├── @angular/platform-browser-dynamic@15.2.10
├── @angular/platform-browser@15.2.10
├── @angular/router@15.2.10
├── @swimlane/ngx-charts@20.5.0
├── @types/d3-scale@4.0.8
├── @types/d3-selection@3.0.10
├── @types/d3-shape@3.1.6
├── @types/jasmine@4.0.3
├── jasmine-core@4.2.0
├── karma-chrome-launcher@3.1.1
├── karma-coverage@2.2.0
├── karma-jasmine-html-reporter@2.0.0
├── karma-jasmine@5.1.0
├── karma@6.4.0
├── rxjs@7.5.6
├── tslib@2.5.0
├── typescript@4.9.5
└── zone.js@0.11.8

I don't know how to fix it ?

Can you help me please ? If you want another part of code tell me !


Solution

  • Try adding this library to the allowedCommonJsDependencies array property of angular.json

    "build": {
      ...
      "options": {
         "allowedCommonJsDependencies": [
            "rfdc"
         ],
         ...