Optimizing File Size
I decided to tackle file size as a fun side project at the office. After our big refactor for JW7 we finally had a modular, clean(er) codebase – so now the fun begins. Let’s squeeze it down as small as possible!
With this kind of task it’s always best to set some goals, pluck the low-hanging fruit and then re-evaluate. Our current player size was 232 kb minified, and as a team we established a goal of reaching 200kb.
To identify targets for refactor, I enabled verbose reporting on WebPack. This causes the compiler to output the size of each module independently. I piped that into a file and deleted everything above and below the modules list.
$ cat modules.txt | tr -s ‘ ‘ | cut -d’ ‘ -f3-5 | grep -v “bytes” | sort -g -r -k2,2
This command takes the modules output from WebPack, trims out the extra spaces, takes the substring between the 3rd and 5th space, removes all rows which are measured in bytes instead of kB and then sorts.
../jwplayer/src/js/providers/html5.js 25.6 kB
../jwplayer/src/js/utils/helpers.js 24.7 kB
../jwplayer/src/js/controller/controller.js 23.7 kB
Continue reading Optimizing Webpack build size
Without rhythm there is nothing
and life has just found its pace,
its cadence of pleasures and twists.
Men nod their head and smile.
We move to the music
as God conducts the world around us.
Moments opportunities and pleasures abound,
plentiful as grain in the field,
waiting to be harvested.