Previously, we were not aggressive in combining common code which resulted in duplicates included in the bundles.
As an example `node_modules/elasticsearch-browser/elasticsearch.angular.js` is present in the following chunks:
* kibana.bundle.js
* dashboardViewer.bundle.js
* apm.bundle.js
* monitoring.bundle.js
* ml.bundle.js
* timelion.bundle.js
* graph.bundle.js
Vendor code (anything inside Kibana's node_modules) is placed in vendors.bundle.js while everything else with more than two references is placed in commons.bundle.js.
This has a couple positive side-effects (numbers are with x-pack & canvas):
* Decreased build time. Seeing builds go from 475.76 seconds to 274.72.
* Decreased memory overhead. Uses roughly 1/3 the memory overhead.
* Decreased bundle size. A 68% reduction in overall bundle size. Going from 66.16 MB to 21.13 MB.
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>