You must be logged in to post your query.
Home › Forums › Chart Support › Angular 10 update for appliaction generates a warning for canvasjs library
Tagged: Angular 10, ECMAScript module
When I updated my application to angular 10, it generated the following warning for CanvasJS library usage.
WARNING in /Users/…./src/app/…..component.ts depends on ‘@assets/canvasjs/canvasjs.min’. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Does CanvasJS library has a ECMAScript module to be used with angular 10 applications? Any help to get rid of the warning (don’t want to turn off the warnings though) is appreciated. Thanks.
@mlimaye,
As you are using a non-ECMAScript Module file for your Angular application, whitelisting CanvasJS should work fine in your case. Please refer to the code below for adding a specific CommonJS dependency in the angular.json file:
angular.json
"architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "allowedCommonJsDependencies": ["assets/canvasjs/*"] } } }
You can also refer to this Stack Overflow thread for more information on whitelisting CommonJS dependencies.
Please take a look at this sample project for a working example with sample code on integrating CanvasJS with Angular.
— Shashi Ranjan Team CanvasJS
Thanks, it worked! But I believe, it only suppresses the warning, not remove/fix the issue. I hope canvasjs can come up with ECMAScript moduled version of the library.
Thanks for your suggestion. We will look into it in future versions.
You must be logged in to reply to this topic. Login/Register