How to exclude installing pdfmaker and xlsx files of Amcharts4 in package.json file in Angular7

Viewed 537

Am using Amcharts4 in angular7 project . After build Vendor.js is 14MB in Size .So load time of the page is taking about 17 seconds .

I saw files like pdfmaker.js 2.54 MB and xlxs.js file of 2MB in dist folder which are related to amcharts .

I don't want those files in dist folder . Or is there any way to reduce the vendor.js file size.

or how can i exclude unnecessary files form amcharts4.

As i did some R&D work where i kept below line of code in package.json file

"build": "ng build --prod --aot false --build-optimizer false",

But no use .

After ng-install in package-lock.json file i can see below dependencies

 "dependencies": {
    "@amcharts/amcharts4": {
      "version": "4.5.2",
      "resolved": "https://registry.npmjs.org/@amcharts/amcharts4/-/amcharts4-4.5.2.tgz",
      "integrity": "sha512-oNK5l73DI61svCUYpmU6YfAB6mlJPmaeLeQceOHOVi4MpYpjUSrghX7lS5HzoNASEa1BtEKjauCAbQ2s8z3b0g==",
      "requires": {
        "@types/regression": "^2.0.0",
        "canvg": "^1.5.3",
        "css-element-queries": "^1.0.5",
        "d3-force": "^2.0.1",
        "d3-geo": "^1.11.3",
        "d3-geo-projection": "^2.6.0",
        "pdfmake": "^0.1.36",
        "polylabel": "^1.0.2",
        "regression": "^2.0.1",
        "tslib": "^1.9.3",
        "xlsx": "^0.12.8"
      }
    },

How Can to exclude "pdfmake": "^0.1.36", "xlsx": "^0.12.8" these dependencies from amharts4 in angular7

1 Answers

Use ngx-build-plus to extend the Angular CLI's default build behavior without ejecting.

Related