Skip to content
Advertisement

Optimizing React App’s Size In Production with Amcharts

I’m using amcharts (amcharts4) with React app(generated using cra).

I was able to successfully exclude few dependencies(cpexcel, canvg, pdfmake) using webpack Externals in webpack.config file (node_modules/react-scripts/config/webpack.config.js) like this:

JavaScript

I also want to exclude the xlsx dependency, but it throws error while building with this configuration:

JavaScript

Error is:

JavaScript

I’m not using any csv feature of amcharts. source-map-explorer

Is there any other possible way to exclude xlsx (without using standalone library and removing manually) in amcharts ?

Advertisement

Answer

The error was because of react-chartjs-2. I was trying few chart libraries and I forgot to remove the library.

Successfully excluded the xlsx library.

JavaScript
Advertisement