-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kendo-grid -> kendo-angular-excel-export = not tree-shakable #2783
Comments
Thank you for reporting this problem. The jszip and pako modules appear not to be tree-shakeable. This is due to side effects caused by code that is executed outside the exported functions. We're researching the option to repackage them as ES modules. This would enable module concatenation as well. |
The development builds now reference ES-module forks of the JSZip and Pako libraries that should be tree-shakeable. You can try it out by switching to the "dev" versions of the following packages: dependencies: {
"@progress/kendo-angular-excel-export": "dev",
"@progress/kendo-drawing": "dev",
"@progress/kendo-ooxml": "dev",
...
} |
The fix is published in the latest versions of the packages. You should see around 140kB improvement in the final bundle size for projects that do not use the PDF and Excel export. |
Thanks @tsvetomir I have analyzed again our project with the latest versions of all packages (still angular 9.x). Is there any possibility to have |
Modules that are not in use should be removed in production builds. Is this a map of the production bundle? |
Yes is the map produce by command: |
I've confirmed that excel-export is getting included. The bundle size is at least somewhat affected by the fix for #2966 that removed the "side-effect free" flag on kendo-drawing. Reopening to investigate. |
This issue turned out to have a really long tail 🐍 In addition to a few unnoticed side effects in Pako and JSZip we had to redo a good deal of the Drawing package. The changes are now in the "dev" channel. You can give it another shot by installing the following packages: Please note that the map still shows JSZip and other modules as part of the bundle. They most certainly are not, as confirmed by inspecting the bundle for some well-known strings from these packages. To be certain, we've set up a few basic scenarios to confirm if tree-shaking is working properly. The results are summarized in the table below:
Test apps: Edit: Fixed project download link |
So thanks @tsvetomir just to know about JSON stats produced by ng. Do you think that the presence of Pako andJSZip on stat file is an issue to report to angular cli team? Secondly, did you test your project with new Angular 10 side effect flag? I'm curious if it decreases bundle size more. Ps: file project link is broken |
The closest issue I could find is webpack-contrib/webpack-bundle-analyzer#161. Based on the comments, it seems like source-map-explorer is more reliable in this case. The report can be generated using the following steps: ng build --prod --stats-json --source-map
sme dist/*/main* --html result.html It does seem more accurate, see result.zip. The bundle indeed includes some code from JSZip, but it's an utility function that takes 2kB. We should be able to clear it out as well, but it's nowhere near the figures reported by Webpack Bundle Analyzer. I couldn't find a reference to "sideEffects" in the Angular docs, apart from strict mode. I tried it in a separate project, but it doesn't seem to have an effect on the bundle size. |
You are right, I mean strict mode that enables side effect flag on web pack configuration. Anyway thanks for the fix I will try fix after stable release! |
We'll be doing extended validation in more complex applications in the following week or so. I'll post updates here. I'm curious to see what the savings look like in a "real world" application like yours. Let's hope they're at least close to what we see in the test cases. |
Here we are developing a really big enterprise framework/application for the automation industry and also a few admin interfaces for some instruments/devices based on our framework. For the first case, nobody cares about bundle size, for device interface, we have limited storage space and it is crucial for us to reduce bytes. What I would like to say is that the kendo grid is really full-featured but really big! |
Some stats for the "main.js" bundle size for the applications in examples (
|
Sorry for the delay. I don't see Attaching the sample project for reference. |
Thanks for your test @tsvetomir . Just to know pako is used only on Grid and Chart components? |
It's a dependency of both of kendo-ooxml and the kendo-drawing package. So Pako could end up as an indirect dependency for any component that supports Excel or PDF export. |
I'm starting to analyze my application using tool to analyze source-map or JSON stats.
Actually I see few packages on the bundle like "jszip" or "pako" that are dependencies of package @progress/kendo-angular-excel-export.
What i have to say is that I don't use any excel directive from the grid component (or other packages).
Just a short question? is kendo-angular-excel-export tree-shakable on your grid library?
Just see image:
The text was updated successfully, but these errors were encountered: