Open achraf-codemaster opened 4 months ago
Try adding "statsJson": true
under "architect" -> "build" -> "options" in your angular.json file. After building, you should find a file called stats.json
in your dist
folder.
Call https://esbuild.github.io/analyze/ and upload this file into the analyzer. You can traverse through the tree view of your packages and identify why the whole ECharts library has been bundled.
In my case, it all seems to depend on an entry point in node_modules? Please correct me, if I'm wrong.
Example for an ECharts component I don't use at all:
How can this be solved?
Description
I have noticed that tree-shaking is not working as expected in the latest version of ngx-echarts (v18) with Angular v18. The bundle size remains the same whether I use the full build or a custom build of ngx-echarts.
Steps to Reproduce
Custom build
Full build
Expected Behavior
The bundle size should be smaller when using a custom build compared to the full build, due to tree-shaking removing unused parts of the library.
Actual Behavior
The bundle size remains the same regardless of whether the full build or a custom build is used.
Results
Bundle size with full build
Bundle size with custom build
Versions
Conclusion
It appears that tree-shaking is not reducing the bundle size as expected. I would appreciate any guidance or fixes to resolve this issue. Thank you!