Search code examples
angularwebpackplotlyplotly.js

Minified plotly.js over 6MB


I have an agular 14 project with plotly.js-dist-min 2.27.1 defined in package.json. The minified version should have 3.6 MB, but when I run webpack-bundle-analyzer with prod build, it shows plotly.js-dist-min to be 6 MB.

enter image description here

This is consistent also with the size of the whole prod build being 16 MB.

enter image description here

I was previously using plotly 1.58.4 directly included as js asset and I did not have that issue. (the scripts 3.32 MB is just plotly).

enter image description here


Solution

  • Plotly comes with different bundles, as mentioned in the readme

    Maybe you can switch to one of these lighter bundles to reduce the size.

    Also kindly check if you have enabled buildOptimizer and optimization to true in angular.json for production build, maybe its turned off?