-
Notifications
You must be signed in to change notification settings - Fork 95
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
Making pdfmake.js optional #1507
Comments
maybe this could help as well? |
@nicolaric pdfmake is already optional, amCharts uses dynamic So if you never export to PDF, then the file will never be loaded, and so it will not have any performance penalty at all. You can confirm this by using the Chrome / Firefox devtools (the Network tab). So you don't have to worry about it, pdfmake will not increase the bundle size, and it won't hurt performance. It has no impact at all on loading times. However, if you really do want to avoid the file completely, then you will need to change your Webpack configuration to ignore those modules: https://www.amcharts.com/docs/v4/getting-started/integrations/using-webpack/#Large_file_sizes externals: function (context, request, callback) {
if (/xlsx|canvg|pdfmake/.test(request)) {
return callback(null, "commonjs " + request);
}
callback();
} |
This issue is stale because it has been open 30 days with no activity. It will be closed in 5 days unless a new comment is added. |
Question
We try to minimize our package size of the application to improve loading times. Since we migrated the whole project from AMCharts4 to AMCharts5 now, we saved a noteable amount of MBs. Now, one of the biggest packages left is pdfmake.js (close to 1MB), which is used by amcharts5. We don't use the PDF functionality in our project though. Is there a possibility to make this package optional or treeshakable in the project without going through webpack tweaks?
Thanks a lot in advance!
The text was updated successfully, but these errors were encountered: