Reduce the size of the built client JS files
!435 (merged) started to rework the build process and strip some useless content out of the built client files. We are now at around 860ko for the main chunk and 450kb extra for the charts. Looking at the output of
webpack-bundle-analyzer, it seems we can shrink it even more. This is low priority, so I am just opening an issue to track possible ideas and enhancements on this subject.
- By being more aggressive on Moment imported locales, we could strip it further, down by 5kb or so.
Getting rid of
IntlAPI or doing it server side), we get rid of a large JSON blob of about 20kb.
Getting rid of
jQuery(currently used by Boostrap code only) makes 85kb go away.
react-datepickeris imported in its minified version and weighs 66kb.
We include the whole
lodashlibrary (for various reasons), maybe we could use something like https://github.com/lodash/lodash-webpack-plugin to prevent from importing everything. Should investigate further.
semveris used for basically two versions comparisons and weighs almost 10kb.
Fetchpolyfill) could be lazy loaded so that only user missing the API get it, and that is 13kb.
- Remove server translations from the client, about 10kb.
preact-compatis about 115kb of minified JS gone. Plus, we could make use of https://github.com/developit/proptypes/blob/master/src/disabled.js to further strip
prop-typesfrom production builds.
PropTypesin production builds should be doable easily and reduce size of built files.
We could lazy-load
rc-color-pickersince most users won't need it, that's a 25kb win. Actually, maybe we should make a
polyfillchunk with all these extra polyfills and lazy-load it.
Same as above,
babel-polyfillis 80kb large.
Note: Sizes are given in minified version, before eventually applying gzip. Also note that many people will most likely serve their Kresus over HTTPS, and that a usual way (but definitely not the best) to mitigate CRIME/BREACH attacks is to disable gzip compression when using HTTPS. So gzip sizes might not be a good indicator here.