ng2-charts.js depends on 'chart.js'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Asked
Active
Viewed 7,549 times
13

akhilreddy
- 272
- 3
- 6
1 Answers
4
Add in angular.json "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "allowedCommonJsDependencies": ["chart.js"],

akhilreddy
- 272
- 3
- 6
-
23This only suppresses the warning, it does not magically solve its underlying cause! – Maurice Apr 10 '21 at 23:45
-
So how to solve this issue ? as this answer will just help to get rid of the message and will just hide it ! – HDJEMAI Apr 14 '21 at 14:01
-
2You load all library and Angular shows warning about this. ChartJs should solve this problem (i.e. with Tree Shake). There is no solution on Angular side. So this answer is best answer. – LacOniC Jul 02 '21 at 07:11
-
Only solution is to update library to remove dependency...Except if library's author doing it, good luck on your side... – Camille Jul 18 '21 at 07:50
-
Property allowedCommonJsDependencies is not allowed. – Hamada Mar 22 '23 at 11:22