@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:
"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